inf.util
Interface DoubleKeyMap<E>

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

public interface DoubleKeyMap<E>
extends java.util.Map<java.lang.Double,E>

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

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

Author:
Gerhard Wickler

Nested Class Summary
static interface DoubleKeyMap.DoubleKeyEntry<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(double key)
           This function returns true if this DoubleKeyMap contains a mapping for the specified key, which is a double here.
 E get(double key)
           This function returns the value to which this DoubleKeyMap maps the specified key, which is a double here.
 E put(double key, E value)
           This function associates the specified key, a double, with the specified value in this DoubleKeyMap.
 E remove(double key)
           This function removes the mapping for this key, a double, from this DoubleKeyMap 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(double key,
      E value)

This function associates the specified key, a double, with the specified value in this DoubleKeyMap. If the DoubleKeyMap 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 DoubleKeyMap previously associated null with the specified key (see get(double)).

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(double key)

This function returns true if this DoubleKeyMap contains a mapping for the specified key, which is a double here.

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

get

E get(double key)

This function returns the value to which this DoubleKeyMap maps the specified key, which is a double here. It returns null if the DoubleKeyMap contains no mapping for this key. A return value of null does not necessarily indicate that the DoubleKeyMap contains no mapping for the key; it is also possible that the DoubleKeyMap explicitly maps the key to null. The containsKey(double) 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 DoubleKeyMap maps the specified key, or null if the DoubleKeyMap contains no mapping for the key

remove

E remove(double key)

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

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