Package org.biojava.nbio.ontology.utils
Class SmallMap
- java.lang.Object
-
- java.util.AbstractMap
-
- org.biojava.nbio.ontology.utils.SmallMap
-
- All Implemented Interfaces:
Serializable
,Map
public class SmallMap extends AbstractMap implements Serializable
Lightweight implementation of Map which uses little memory to store a small number of mappings, at the expense of scalability. Not recommended for more than 20-30 mappings.This implementation has the useful property that the iteration order is the same as the order in which mappings are added.
- Author:
- Thomas Down, Len Trigg
- 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>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(Object key)
Set
entrySet()
Object
get(Object key)
Set
keySet()
Object
put(Object key, Object value)
int
size()
-
Methods inherited from class java.util.AbstractMap
clear, clone, containsValue, equals, hashCode, isEmpty, putAll, remove, 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
-
-
-
-
Method Detail
-
get
public Object get(Object key)
- Specified by:
get
in interfaceMap
- Overrides:
get
in classAbstractMap
- Throws:
NullPointerException
- if key is null
-
put
public Object put(Object key, Object value)
- Specified by:
put
in interfaceMap
- Overrides:
put
in classAbstractMap
- Throws:
NullPointerException
- if key is null
-
keySet
public Set keySet()
- Specified by:
keySet
in interfaceMap
- Overrides:
keySet
in classAbstractMap
-
entrySet
public Set entrySet()
- Specified by:
entrySet
in interfaceMap
- Specified by:
entrySet
in classAbstractMap
-
size
public int size()
- Specified by:
size
in interfaceMap
- Overrides:
size
in classAbstractMap
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey
in interfaceMap
- Overrides:
containsKey
in classAbstractMap
-
-