Fixed error.
The order of checking for null prioritizing was swapped.
This commit is contained in:
parent
6f27e52c6b
commit
4c93e85078
@ -2,8 +2,6 @@ package ca.recrown.islandsurvivalcraft.caching;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
|
||||
public class Cache<K, V> {
|
||||
private final int maxSize;
|
||||
@ -56,8 +54,8 @@ public class Cache<K, V> {
|
||||
*/
|
||||
public V get(K key) {
|
||||
CacheValue<K, V> value = data.get(key);
|
||||
usage.tryMoveToTop(value);
|
||||
if (value == null) return null;
|
||||
usage.tryMoveToTop(value);
|
||||
return value.value;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user