Package org.apache.ignite.internal.util
Class GridLeanMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- org.apache.ignite.internal.util.GridSerializableMap<K,V>
-
- org.apache.ignite.internal.util.GridLeanMap<K,V>
-
- All Implemented Interfaces:
Serializable,Cloneable,Map<K,V>
public class GridLeanMap<K,V> extends GridSerializableMap<K,V> implements Cloneable
Lean map implementation that keeps up to five entries in its fields.Null-keys are not supported.- 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>
-
-
Constructor Summary
Constructors Constructor Description GridLeanMap()Constructs lean map with initial size of3.GridLeanMap(int size)Constructs lean map with initial size.GridLeanMap(Map<K,V> m)Constructs lean map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()protected Objectclone()booleancontainsKey(Object key)booleancontainsValue(Object val)Set<Map.Entry<K,V>>entrySet()Vget(Object key)Vput(K key, V val)Vremove(Object key)intsize()-
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, keySet, putAll, toString, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Constructor Detail
-
GridLeanMap
public GridLeanMap()
Constructs lean map with initial size of3.
-
GridLeanMap
public GridLeanMap(int size)
Constructs lean map with initial size.If given size is greater than zero then map activates batch mode for put() operations. In this mode map allows to put up to size number of key-value pairs without internal size optimization, i.e. each next put() in batch doesn't switch backing implementation so that initial implementation is used as long as its capacity allows.
Note that any removal operation either through iterator or map itself turns batch mode off and map starts optimizing size after any modification.
- Parameters:
size- Initial size.
-
-
Method Detail
-
size
public int size()
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<K,V>- Overrides:
containsKeyin classAbstractMap<K,V>
-
containsValue
public boolean containsValue(Object val)
- Specified by:
containsValuein interfaceMap<K,V>- Overrides:
containsValuein classAbstractMap<K,V>
-
put
@Nullable public V put(K key, V val) throws NullPointerException
- Specified by:
putin interfaceMap<K,V>- Overrides:
putin classAbstractMap<K,V>- Throws:
NullPointerException
-
clear
public void clear()
-
clone
protected Object clone()
- Overrides:
clonein classAbstractMap<K,V>
-
-