net.ontopia.utils
Class CompactHashMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by net.ontopia.utils.CompactHashMap<K,V>
All Implemented Interfaces:
java.util.Map<K,V>

public class CompactHashMap<K,V>
extends java.util.AbstractMap<K,V>


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
CompactHashMap()
          Constructs a new, empty set.
CompactHashMap(int size)
          Constructs a new, empty set.
 
Method Summary
 void clear()
          Removes all key/value mappings in the map.
 boolean containsKey(java.lang.Object k)
          Returns true if this map contains the specified key.
 boolean containsValue(java.lang.Object v)
          Returns true if this map contains the specified value.
 java.util.Set entrySet()
          Returns a read-only set view of the map's keys.
 V get(java.lang.Object k)
          Returns the value for the key k, if there is one, and null if there is none.
 boolean isEmpty()
          Returns true if this map contains no mappings.
 java.util.Set<K> keySet()
          Returns a virtual read-only set of all the keys in the map.
 V put(java.lang.Object k, java.lang.Object v)
          Adds the specified mapping to this map, returning the old value for the mapping, if there was one.
 V remove(java.lang.Object k)
          Removes the mapping with key k, if there is one, and returns its value, if there is one, and null if there is none.
 int size()
          Returns the number of key/value mappings in this map.
 java.util.Collection<V> values()
          Returns a virtual read-only collection containing all the values in the map.
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, putAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompactHashMap

public CompactHashMap()
Constructs a new, empty set.


CompactHashMap

public CompactHashMap(int size)
Constructs a new, empty set.

Method Detail

size

public int size()
Returns the number of key/value mappings in this map.

Specified by:
size in interface java.util.Map<K,V>
Overrides:
size in class java.util.AbstractMap<K,V>

isEmpty

public boolean isEmpty()
Returns true if this map contains no mappings.

Specified by:
isEmpty in interface java.util.Map<K,V>
Overrides:
isEmpty in class java.util.AbstractMap<K,V>

clear

public void clear()
Removes all key/value mappings in the map.

Specified by:
clear in interface java.util.Map<K,V>
Overrides:
clear in class java.util.AbstractMap<K,V>

containsKey

public boolean containsKey(java.lang.Object k)
Returns true if this map contains the specified key.

Specified by:
containsKey in interface java.util.Map<K,V>
Overrides:
containsKey in class java.util.AbstractMap<K,V>

containsValue

public boolean containsValue(java.lang.Object v)
Returns true if this map contains the specified value.

Specified by:
containsValue in interface java.util.Map<K,V>
Overrides:
containsValue in class java.util.AbstractMap<K,V>

entrySet

public java.util.Set entrySet()
Returns a read-only set view of the map's keys.

Specified by:
entrySet in interface java.util.Map<K,V>
Specified by:
entrySet in class java.util.AbstractMap<K,V>

remove

public V remove(java.lang.Object k)
Removes the mapping with key k, if there is one, and returns its value, if there is one, and null if there is none.

Specified by:
remove in interface java.util.Map<K,V>
Overrides:
remove in class java.util.AbstractMap<K,V>

put

public V put(java.lang.Object k,
             java.lang.Object v)
Adds the specified mapping to this map, returning the old value for the mapping, if there was one.

Specified by:
put in interface java.util.Map<K,V>
Overrides:
put in class java.util.AbstractMap<K,V>

get

public V get(java.lang.Object k)
Returns the value for the key k, if there is one, and null if there is none.

Specified by:
get in interface java.util.Map<K,V>
Overrides:
get in class java.util.AbstractMap<K,V>

values

public java.util.Collection<V> values()
Returns a virtual read-only collection containing all the values in the map.

Specified by:
values in interface java.util.Map<K,V>
Overrides:
values in class java.util.AbstractMap<K,V>

keySet

public java.util.Set<K> keySet()
Returns a virtual read-only set of all the keys in the map.

Specified by:
keySet in interface java.util.Map<K,V>
Overrides:
keySet in class java.util.AbstractMap<K,V>


Copyright © 2000-2010 Ontopia.