gnu.trove.decorator

Class TFloatLongHashMapDecorator

public class TFloatLongHashMapDecorator extends AbstractMap implements Map

Wrapper class to make a TFloatLongHashMap conform to the java.util.Map API. This class simply decorates an underlying TFloatLongHashMap 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

Since: trove 0.1.8

Version: $Id: TFloatLongHashMapDecorator.java,v 1.1 2002/09/25 05:10:08 ericdf Exp $

Author: Eric D. Friedman

Field Summary
protected TFloatLongHashMap_map
the wrapped primitive map
Constructor Summary
TFloatLongHashMapDecorator(TFloatLongHashMap map)
Creates a wrapper that decorates the specified primitive map.
Method Summary
voidclear()
Empties the map.
booleancontainsKey(Object key)
Checks for the present of key in the keys of the map.
booleancontainsValue(Object val)
Checks for the presence of val in the values of the map.
SetentrySet()
Returns a Set view on the entries of the map.
booleanequals(Object other)
Compares this map with another map for equality of their stored entries.
Objectget(Object key)
Retrieves the value for key
booleanisEmpty()
Indicates whether map has any entries.
Objectput(Object key, Object value)
Inserts a key/value pair into the map.
voidputAll(Map map)
Copies the key/value mappings in map into this map.
Objectremove(Object key)
Deletes a key/value pair from the map.
intsize()
Returns the number of entries in the map.
protected floatunwrapKey(Object key)
Unwraps a key
protected longunwrapValue(Object value)
Unwraps a value
protected FloatwrapKey(float k)
Wraps a key
protected LongwrapValue(long k)
Wraps a value

Field Detail

_map

protected final TFloatLongHashMap _map
the wrapped primitive map

Constructor Detail

TFloatLongHashMapDecorator

public TFloatLongHashMapDecorator(TFloatLongHashMap map)
Creates a wrapper that decorates the specified primitive map.

Method Detail

clear

public void clear()
Empties the map.

containsKey

public boolean containsKey(Object key)
Checks for the present of key in the keys of the map.

Parameters: key an Object value

Returns: a boolean value

containsValue

public boolean containsValue(Object val)
Checks for the presence of val in the values of the map.

Parameters: val an Object value

Returns: a boolean value

entrySet

public Set entrySet()
Returns a Set view on the entries of the map.

Returns: a Set value

equals

public boolean equals(Object other)
Compares this map with another map for equality of their stored entries.

Parameters: other an Object value

Returns: true if the maps are identical

get

public Object get(Object key)
Retrieves the value for key

Parameters: key an Object value

Returns: the value of key or null if no such mapping exists.

isEmpty

public boolean isEmpty()
Indicates whether map has any entries.

Returns: true if the map is empty

put

public Object put(Object key, Object value)
Inserts a key/value pair into the map.

Parameters: key an Object value value an Object value

Returns: the previous value associated with key, or Integer(0) if none was found.

putAll

public void putAll(Map 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.

Parameters: map a Map value

remove

public Object remove(Object key)
Deletes a key/value pair from the map.

Parameters: key an Object value

Returns: the removed value, or Integer(0) if it was not found in the map

size

public int size()
Returns the number of entries in the map.

Returns: the map's size.

unwrapKey

protected float unwrapKey(Object key)
Unwraps a key

Parameters: a wrapped key

Returns: an unwrapped representation of the key

unwrapValue

protected long unwrapValue(Object value)
Unwraps a value

Parameters: a wrapped value

Returns: an unwrapped representation of the value

wrapKey

protected Float wrapKey(float k)
Wraps a key

Parameters: a key in the underlying map

Returns: an Object representation of the key

wrapValue

protected Long wrapValue(long k)
Wraps a value

Parameters: a value in the underlying map

Returns: an Object representation of the value