AnyLogic
Expand
Font size
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>

@AnyLogicInternalAPI
public class LRUCache<K,V>
extends LinkedHashMap<K,V>
See Also:
Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class java.util.AbstractMap

AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>

Field Summary

Modifier and TypeFieldDescription
static final booleanDEFAULT_ACCESS_ORDER 
static final intDEFAULT_INITITAL_CAPACITY 
static final floatDEFAULT_LOAD_FACTOR 

Constructor Summary

ConstructorDescription
LRUCache(int cacheSize)
Constructs an empty LRUCache instance with the specified cache capacity.
LRUCache(int cacheSize, float loadFactor, boolean accessOrder)
Constructs an empty LRUCache instance with the specified cache capacity, load factor and ordering mode.

Method Summary

Methods inherited from class java.util.LinkedHashMap

clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values

Methods inherited from class java.util.AbstractMap

equals, hashCode, toString

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Field Details

DEFAULT_INITITAL_CAPACITY

public static final int DEFAULT_INITITAL_CAPACITY
See Also:
Constant Field Values

DEFAULT_LOAD_FACTOR

public static final float DEFAULT_LOAD_FACTOR
See Also:
Constant Field Values

DEFAULT_ACCESS_ORDER

public static final boolean DEFAULT_ACCESS_ORDER
See Also:
Constant Field Values

Constructor Details

LRUCache

public LRUCache(int cacheSize)
Constructs an empty LRUCache instance with the specified cache capacity.
Parameters:
cacheSize - cache size

LRUCache

public LRUCache(int cacheSize,
 float loadFactor,
 boolean accessOrder)
Constructs an empty LRUCache instance with the specified cache capacity, load factor and ordering mode.
Parameters:
cacheSize - the cache size
accessOrder - the ordering mode - true for access-order, false for insertion-order