Package gnu.trove.decorator
Class TShortObjectMapDecorator<V>
- All Implemented Interfaces:
Externalizable
,Serializable
,Cloneable
,Map<Short,
V>
public class TShortObjectMapDecorator<V>
extends AbstractMap<Short,V>
implements Map<Short,V>, Externalizable, Cloneable
Wrapper class to make a TShortObjectMap conform to the java.util.Map API.
This class simply decorates an underlying TShortObjectMap 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
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFOR EXTERNALIZATION ONLY!!Creates a wrapper that decorates the specified primitive map. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Empties the map.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.entrySet()
Returns a Set view on the entries of the map.Retrieves the value for keygetMap()
Returns a reference to the map wrapped by this decorator.boolean
isEmpty()
Indicates whether map has any entries.Inserts a key/value pair into the map.void
Copies the key/value mappings in map into this map.void
Deletes a key/value pair from the map.int
size()
Returns the number of entries in the map.protected short
Unwraps a keyprotected Short
wrapKey
(short k) Wraps a keyvoid
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, keySet, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, values
-
Field Details
-
_map
the wrapped primitive map
-
-
Constructor Details
-
TShortObjectMapDecorator
public TShortObjectMapDecorator()FOR EXTERNALIZATION ONLY!! -
TShortObjectMapDecorator
Creates a wrapper that decorates the specified primitive map.- Parameters:
map
- the TShortObjectMap to wrap.
-
-
Method Details
-
getMap
Returns a reference to the map wrapped by this decorator.- Returns:
- the wrapped TShortObjectMap instance.
-
put
Inserts a key/value pair into the map. -
get
Retrieves the value for key -
clear
public void clear()Empties the map. -
remove
Deletes a key/value pair from the map. -
entrySet
Returns a Set view on the entries of the map. -
containsValue
Checks for the presence of val in the values of the map.- Specified by:
containsValue
in interfaceMap<Short,
V> - Overrides:
containsValue
in classAbstractMap<Short,
V> - Parameters:
val
- anObject
value- Returns:
- a
boolean
value
-
containsKey
Checks for the present of key in the keys of the map.- Specified by:
containsKey
in interfaceMap<Short,
V> - Overrides:
containsKey
in classAbstractMap<Short,
V> - Parameters:
key
- anObject
value- Returns:
- a
boolean
value
-
size
public int size()Returns the number of entries in the map. -
isEmpty
public boolean isEmpty()Indicates whether map has any entries. -
putAll
Copies the key/value mappings in map into this map. Note that this will be a deep copy, as storage is by primitive value. -
wrapKey
Wraps a key- Parameters:
k
- key in the underlying map- Returns:
- an Object representation of the key
-
unwrapKey
Unwraps a key- Parameters:
key
- wrapped key- Returns:
- an unwrapped representation of the key
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-