Package zombie.util.map
Class AbstractIntKeyMap<V>
java.lang.Object
zombie.util.map.AbstractIntKeyMap<V>
- All Implemented Interfaces:
IntKeyMap<V>
- Direct Known Subclasses:
IntKeyOpenHashMap
This class represents an abstract base for implementing
maps from int values to objects. All operations that can be implemented
using iterators
are implemented as such. In most cases, this is
hardly an efficient solution, and at least some of those
methods should be overridden by sub-classes.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears this map.boolean
containsKey
(int key) Indicates whether this map contains a mapping from a specified key.boolean
containsValue
(Object value) Indicates whether this map contains a mapping to a specified value.boolean
Indicates whether this map is equal to some object.get
(int key) Maps a specified key to a value.int
hashCode()
Returns a hash code value for this map.boolean
isEmpty()
Indicates whether this map is empty.void
Adds all mappings from a specified map to this map.remove
(int key) Removes the mapping from a specified key from this map.int
size()
Returns the size of this map.toString()
Returns a string representation of this map.void
Does nothing.
-
Method Details
-
clear
public void clear()Description copied from interface:IntKeyMap
Clears this map. -
remove
Description copied from interface:IntKeyMap
Removes the mapping from a specified key from this map. -
putAll
Description copied from interface:IntKeyMap
Adds all mappings from a specified map to this map. Any existing mappings whose keys collide with a new mapping is overwritten by the new mapping. -
containsKey
public boolean containsKey(int key) Description copied from interface:IntKeyMap
Indicates whether this map contains a mapping from a specified key.- Specified by:
containsKey
in interfaceIntKeyMap<V>
- Parameters:
key
- the key to test for.- Returns:
- true if this map contains a mapping from the specified key; returns false otherwise.
-
get
Description copied from interface:IntKeyMap
Maps a specified key to a value. -
containsValue
Description copied from interface:IntKeyMap
Indicates whether this map contains a mapping to a specified value.- Specified by:
containsValue
in interfaceIntKeyMap<V>
- Parameters:
value
- the value to test for.- Returns:
- true if this map contains at least one mapping to the specified value; returns false otherwise.
-
equals
Description copied from interface:IntKeyMap
Indicates whether this map is equal to some object. -
hashCode
public int hashCode()Description copied from interface:IntKeyMap
Returns a hash code value for this map. -
isEmpty
public boolean isEmpty()Description copied from interface:IntKeyMap
Indicates whether this map is empty. -
size
public int size()Description copied from interface:IntKeyMap
Returns the size of this map. The size is defined as the number of mappings from keys to values. -
toString
Returns a string representation of this map. -
trimToSize
public void trimToSize()Does nothing. Sub-classes may provide an implementation to minimize memory usage, but this is not required since many implementations will always have minimal memory usage.
-