gnu.trove.decorator
Class TIntShortHashMapDecorator
AbstractMap
gnu.trove.decorator.TIntShortHashMapDecorator
- Cloneable, Map
public class TIntShortHashMapDecorator
extends AbstractMap
implements Map, Cloneable
Wrapper class to make a TIntShortHashMap conform to the
java.util.Map API.
This class simply decorates an underlying TIntShortHashMap and translates the Object-based
APIs into their Trove primitive analogs.
Note that wrapping and unwrapping primitive values is extremely inefficient. If
possible, users of this class should override the appropriate methods in this class
and use a table of canonical values.
Created: Mon Sep 23 22:07:40 PDT 2002
protected TIntShortHashMap | _map - the wrapped primitive map
|
void | clear() - Empties the map.
|
TIntShortHashMapDecorator | clone() - Clones the underlying trove collection and returns the clone wrapped in a new
decorator instance.
|
boolean | containsKey(Object key) - Checks for the present of key in the keys of the map.
|
boolean | containsValue(Object val) - Checks for the presence of val in the values of the map.
|
Set> | entrySet() - Returns a Set view on the entries of the map.
|
boolean | equals(Object other) - Compares this map with another map for equality of their stored
entries.
|
Short | get(Integer key) - Retrieves the value for key
|
TIntShortHashMap | getMap() - Returns a reference to the map wrapped by this decorator.
|
boolean | isEmpty() - Indicates whether map has any entries.
|
Short | put(Integer key, Short value) - Inserts a key/value pair into the map.
|
void | putAll(extends Integer, Short> map) - Copies the key/value mappings in map into this map.
|
Short | remove(Integer key) - Deletes a key/value pair from the map.
|
int | size() - Returns the number of entries in the map.
|
protected int | unwrapKey(Object key) - Unwraps a key
|
protected short | unwrapValue(Object value) - Unwraps a value
|
protected Integer | wrapKey(int k) - Wraps a key
|
protected Short | wrapValue(short k) - Wraps a value
|
_map
protected TIntShortHashMap _map
the wrapped primitive map
TIntShortHashMapDecorator
public TIntShortHashMapDecorator(TIntShortHashMap map)
Creates a wrapper that decorates the specified primitive map.
clear
public void clear()
Empties the map.
clone
public TIntShortHashMapDecorator clone()
Clones the underlying trove collection and returns the clone wrapped in a new
decorator instance. This is a shallow clone except where primitives are
concerned.
containsKey
public boolean containsKey(Object key)
Checks for the present of key in the keys of the map.
containsValue
public boolean containsValue(Object val)
Checks for the presence of val in the values of the map.
entrySet
public Set> entrySet()
Returns a Set view on the entries of the map.
equals
public boolean equals(Object other)
Compares this map with another map for equality of their stored
entries.
- true if the maps are identical
get
public Short get(Integer key)
Retrieves the value for key
- the value of key or null if no such mapping exists.
getMap
public TIntShortHashMap getMap()
Returns a reference to the map wrapped by this decorator.
isEmpty
public boolean isEmpty()
Indicates whether map has any entries.
put
public Short put(Integer key,
Short value)
Inserts a key/value pair into the map.
key
- an Object
valuevalue
- an Object
value
- the previous value associated with key,
or Short(0) if none was found.
putAll
public void putAll(extends Integer,
Short> map)
Copies the key/value mappings in map into this map.
Note that this will be a deep copy, as storage is by
primitive value.
remove
public Short remove(Integer key)
Deletes a key/value pair from the map.
- the removed value, or Short(0) if it was not found in the map
size
public int size()
Returns the number of entries in the map.
unwrapKey
protected int unwrapKey(Object key)
Unwraps a key
- an unwrapped representation of the key
unwrapValue
protected short unwrapValue(Object value)
Unwraps a value
- an unwrapped representation of the value
wrapKey
protected Integer wrapKey(int k)
Wraps a key
k
- key in the underlying map
- an Object representation of the key
wrapValue
protected Short wrapValue(short k)
Wraps a value
k
- value in the underlying map
- an Object representation of the value
GNU Trove is copyright B) 2001-2007 Eric D. Friedman. All Rights Reserved.