ch.javasoft.util.intcoll
Class DefaultIntIntMap
java.lang.Object
java.util.AbstractMap<Integer,Integer>
ch.javasoft.util.intcoll.AbstractIntIntMap
ch.javasoft.util.intcoll.DefaultIntIntMap
- All Implemented Interfaces:
- IntIntMap, IntMap<Integer>, Serializable, Cloneable, Map<Integer,Integer>
public class DefaultIntIntMap
- extends AbstractIntIntMap
- implements Serializable, Cloneable
DefaultIntIntMap is an mutable mapping from int to int. It is
implemented with two lists for keys and values, and the key list is sorted.
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
| Methods inherited from class ch.javasoft.util.intcoll.AbstractIntIntMap |
containsKey, containsValue, entrySet, get, get, intEntrySet, put, put, putAll, putAll, remove |
| Methods inherited from interface java.util.Map |
hashCode |
DefaultIntIntMap
public DefaultIntIntMap()
- Constructor for a new empty map
DefaultIntIntMap
public DefaultIntIntMap(int capacity)
- Constructor for a new empty map of the given initial capacity
DefaultIntIntMap
public DefaultIntIntMap(DefaultIntIntMap copy)
DefaultIntIntMap
public DefaultIntIntMap(Map<Integer,Integer> map)
getInt
public int getInt(int key)
- Description copied from interface:
IntIntMap
- Returns the int value for the specified key, or throws a
NoSuchElementException otherwise
- Specified by:
getInt in interface IntIntMap
- Parameters:
key - the key for which the value shall be returned
- Returns:
- the value associated with the given key
containsKey
public boolean containsKey(int key)
- Specified by:
containsKey in interface IntIntMap- Specified by:
containsKey in interface IntMap<Integer>- Overrides:
containsKey in class AbstractIntIntMap
containsValue
public boolean containsValue(int value)
- Specified by:
containsValue in interface IntIntMap
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Map<Integer,Integer>- Overrides:
isEmpty in class AbstractIntIntMap
size
public int size()
- Specified by:
size in interface Map<Integer,Integer>- Overrides:
size in class AbstractMap<Integer,Integer>
keySet
public IntSet keySet()
- Specified by:
keySet in interface IntMap<Integer>- Specified by:
keySet in interface Map<Integer,Integer>- Specified by:
keySet in class AbstractIntIntMap
intIntEntrySet
public Set<IntIntMap.IntIntEntry> intIntEntrySet()
- Specified by:
intIntEntrySet in interface IntIntMap
values
public IntCollection values()
- Specified by:
values in interface IntIntMap- Specified by:
values in interface Map<Integer,Integer>- Specified by:
values in class AbstractIntIntMap
toKeyArray
public int[] toKeyArray()
- Returns the keys as a sorted int array. The key at position i corresponds
to the value at position i as returned by
toValueArray()
- Returns:
- a copy of the sorted key array
toValueArray
public int[] toValueArray()
- Returns the values as an int array. The value at position i corresponds
to the key at position i as returned by
toKeyArray()
- Returns:
- a copy of the value array
equals
public boolean equals(Object o)
- Specified by:
equals in interface Map<Integer,Integer>- Overrides:
equals in class AbstractMap<Integer,Integer>
put
public Integer put(int key,
int value)
- Specified by:
put in interface IntIntMap
putAll
public void putAll(IntIntMap map)
- Specified by:
putAll in interface IntIntMap- Overrides:
putAll in class AbstractIntIntMap
clear
public void clear()
- Specified by:
clear in interface Map<Integer,Integer>- Overrides:
clear in class AbstractMap<Integer,Integer>
remove
public Integer remove(int key)
- Specified by:
remove in interface IntMap<Integer>
clone
public DefaultIntIntMap clone()
- Overrides:
clone in class AbstractMap<Integer,Integer>