inf.util
Interface IntKeyMap<E>

Type Parameters:
E - the element type for the values to which the keys are mapped
All Superinterfaces:
java.util.Map<java.lang.Integer,E>
All Known Implementing Classes:
IntKeyTreeMap

public interface IntKeyMap<E>
extends java.util.Map<java.lang.Integer,E>

This is a Map that maps ints (keys) to Objects (values). If the key is given as an Integer rather than an int, it must not be null. Values are allowed to be null.

The idea behind this interface is that the use of ints as keys (rather than Integer objects) should allow for more efficient (time and memory) implementations of this interface.

Author:
Gerhard Wickler

Nested Class Summary
static interface IntKeyMap.IntKeyEntry<E>
           A node in the Map.
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Method Summary
 boolean containsKey(int key)
           This function returns true if this IntKeyMap contains a mapping for the specified key, which is an int here.
 E get(int key)
           This function returns the value to which this IntKeyMap maps the specified key, which is an int here.
 E put(int key, E value)
           This function associates the specified key, an int, with the specified value in this IntKeyMap.
 E remove(int key)
           This function removes the mapping for this key, an int, from this IntKeyMap if it was present.
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Method Detail

put

E put(int key,
      E value)

This function associates the specified key, an int, with the specified value in this IntKeyMap. If the IntKeyMap previously contained a mapping for this key, the old value is replaced. The old value is also used as the return value of this function. A null return may indicate that no previous association existed or that the IntKeyMap previously associated null with the specified key (see get(int)).

Parameters:
key - the key with which the specified value is to be associated
value - the value to be associated with the specified key
Returns:
previous value associated with specified key, or null if there was no mapping for the key

containsKey

boolean containsKey(int key)

This function returns true if this IntKeyMap contains a mapping for the specified key, which is an int here.

Parameters:
key - the key whose presence in this IntKeyMap is to be tested
Returns:
true if this IntKeyMap contains a mapping for the specified key

get

E get(int key)

This function returns the value to which this IntKeyMap maps the specified key, which is an int here. It returns null if the IntKeyMap contains no mapping for this key. A return value of null does not necessarily indicate that the IntKeyMap contains no mapping for the key; it is also possible that the IntKeyMap explicitly maps the key to null. The containsKey(int) operation may be used to distinguish these two cases.

Parameters:
key - key whose associated value is to be returned
Returns:
the value to which this IntKeyMap maps the specified key, or null if the IntKeyMap contains no mapping for the key

remove

E remove(int key)

This function removes the mapping for this key, an int, from this IntKeyMap if it was present. The value the key was mapped to is returned. A null return may indicate that the IntKeyMap previously associated null with the specified key (see get(int)).

Parameters:
key - the key to the mapping that is to be removed
Returns:
the previous value associated with specified key, or null if there was no mapping for the key