org.biojava.utils
Class SmallMap

java.lang.Object
  extended by java.util.AbstractMap
      extended by org.biojava.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 interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
SmallMap()
           
SmallMap(int size)
           
SmallMap(Map m)
           
 
Method Summary
 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
 

Constructor Detail

SmallMap

public SmallMap()

SmallMap

public SmallMap(int size)

SmallMap

public SmallMap(Map m)
Method Detail

get

public Object get(Object key)
Specified by:
get in interface Map
Overrides:
get in class AbstractMap
Throws:
NullPointerException - if key is null

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map
Overrides:
put in class AbstractMap
Throws:
NullPointerException - if key is null

keySet

public Set keySet()
Specified by:
keySet in interface Map
Overrides:
keySet in class AbstractMap

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map
Specified by:
entrySet in class AbstractMap

size

public int size()
Specified by:
size in interface Map
Overrides:
size in class AbstractMap

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map
Overrides:
containsKey in class AbstractMap