zombie.util.map
Interface IntKeyMap<V>

All Known Implementing Classes:
AbstractIntKeyMap, IntKeyOpenHashMap

public interface IntKeyMap<V>

This interface represents maps from int values to objects.

Since:
1.0
Version:
1.1 2003/6/1
Author:
Søren Bak
See Also:
Map

Method Summary
 void clear()
          Clears this map.
 boolean containsKey(int key)
          Indicates whether this map contains a mapping from a specified key.
 boolean containsValue(java.lang.Object value)
          Indicates whether this map contains a mapping to a specified value.
 IntKeyMapIterator<V> entries()
          Returns an iterator over the entries of this map.
 boolean equals(java.lang.Object obj)
          Indicates whether this map is equal to some object.
 V 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.
 IntSet keySet()
          Returns a set view of the keys of this map.
 V put(int key, V value)
          Adds a mapping from a specified key to a specified value to this map.
 void putAll(IntKeyMap<V> map)
          Adds all mappings from a specified map to this map.
 V remove(int key)
          Removes the mapping from a specified key from this map.
 int size()
          Returns the size of this map.
 java.util.Collection<V> values()
          Returns a collection view of the values in this map.
 

Method Detail

clear

void clear()
Clears this map.


containsKey

boolean containsKey(int key)
Indicates whether this map contains a mapping from a specified key.

Parameters:
key - the key to test for.
Returns:
true if this map contains a mapping from the specified key; returns false otherwise.

containsValue

boolean containsValue(java.lang.Object value)
Indicates whether this map contains a mapping to a specified value.

Parameters:
value - the value to test for.
Returns:
true if this map contains at least one mapping to the specified value; returns false otherwise.

entries

IntKeyMapIterator<V> entries()
Returns an iterator over the entries of this map. It is possible to remove entries from this map using the iterator provided that the concrete map supports removal of entries.

Returns:
an iterator over the entries of this map.

equals

boolean equals(java.lang.Object obj)
Indicates whether this map is equal to some object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object with which to compare this map.
Returns:
true if this map is equal to the specified object; returns false otherwise.

get

V get(int key)
Maps a specified key to a value.

Parameters:
key - the key to map to a value.
Returns:
the value that the specified key maps to; returns null, if no mapping exists for the specified key.

hashCode

int hashCode()
Returns a hash code value for this map.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this map.

isEmpty

boolean isEmpty()
Indicates whether this map is empty.

Returns:
true if this map is empty; returns false otherwise.

keySet

IntSet keySet()
Returns a set view of the keys of this map. The set is not directly modifiable, but changes to the map are reflected in the set.

Returns:
a set view of the keys of this map.

put

V put(int key,
      V value)
Adds a mapping from a specified key to a specified value to this map. If a mapping already exists for the specified key it is overwritten by the new mapping.

Parameters:
key - the key of the mapping to add to this map.
value - the value of the mapping to add to this map.
Returns:
the old value (which can be null) if a mapping from the specified key already existed in this map; returns null otherwise.
Throws:
java.lang.UnsupportedOperationException - if the operation is not supported by this map.

putAll

void putAll(IntKeyMap<V> map)
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.

Parameters:
map - the map whose mappings to add to this map.
Throws:
java.lang.NullPointerException - if map is null.
java.lang.UnsupportedOperationException - if the operation is not supported by this map.

remove

V remove(int key)
Removes the mapping from a specified key from this map.

Parameters:
key - the key whose mapping to remove from this map.
Returns:
the old value (which can be null) if a mapping from the specified key already existed in this map; returns null otherwise.
Throws:
java.lang.UnsupportedOperationException - if the operation is not supported by this map.

size

int size()
Returns the size of this map. The size is defined as the number of mappings from keys to values.

Returns:
the size of this map.

values

java.util.Collection<V> values()
Returns a collection view of the values in this map. The collection is not modifiable, but changes to the map are reflected in the collection.

Returns:
a collection view of the values in this map.