K
- type of the hashtable keysV
- type of the hashtable valuesIHashtable<K,V>
public class DefaultHashtable<K,V> extends java.lang.Object implements IHashtable<K,V>
IHashtable<K,V>
interface,
employing java.util.Hashtable
class.Constructor | Description |
---|---|
DefaultHashtable() |
Constructs a new, empty hashtable with a default initial capacity and load factor
|
DefaultHashtable(int initialCapacity) |
Constructs a new, empty hashtable with the specified initial capacity
and default load factor
|
DefaultHashtable(int initialCapacity,
float loadFactor) |
Constructs a new, empty hashtable with the specified initial
capacity and the specified load factor
|
DefaultHashtable(java.util.Hashtable hashtable) |
Sets given reference to the underlying hashtable
|
Modifier and Type | Method | Description |
---|---|---|
void |
clear() |
(@inheritDoc}
|
boolean |
contains(java.lang.Object value) |
Tests if some key maps into the specified value in the hashtable.
|
boolean |
containsKey(java.lang.Object key) |
Tests if the specified object is a key in the hashtable.
|
boolean |
containsValue(java.lang.Object value) |
Returns
true if the hashtable maps one or more keys to this value. |
java.util.Enumeration<V> |
elements() |
Returns an enumeration of the values in the hashtable.
|
V |
get(java.lang.Object key) |
Returns the value to which the specified key is mapped in the hashtable.
|
java.util.Hashtable |
getHashtable() |
Gets reference to the underlying hashtable of type
java.util.Hashtable |
boolean |
isEmpty() |
Tests if the hashtable maps no keys to values.
|
java.util.Enumeration<K> |
keys() |
Returns an enumeration of the keys in the hashtable.
|
V |
put(K key,
V value) |
Maps the specified
key to the specified
value in the hashtable. |
V |
remove(java.lang.Object key) |
Removes the key (and its corresponding value) from the
hashtable.
|
void |
setHashtable(java.lang.Object hashtable) |
Sets given reference to the underlying hashtable of type
java.util.Hashtable |
int |
size() |
Returns the number of keys in the hashtable
|
java.lang.String |
toString() |
Returns a string representation of the hashtable.
|
public DefaultHashtable()
public DefaultHashtable(int initialCapacity)
initialCapacity
- the initial capacity of the hashtablepublic DefaultHashtable(int initialCapacity, float loadFactor)
initialCapacity
- the initial capacity of the hashtableloadFactor
- the load factor of the hashtablepublic DefaultHashtable(java.util.Hashtable hashtable)
hashtable
- reference to the underlying hashtablepublic void clear()
clear
in interface IHashtable<K,V>
public boolean contains(java.lang.Object value)
contains
in interface IHashtable<K,V>
value
- a value to search fortrue
if and only if some key maps to the
value
argument in the hashtable,
false
otherwisepublic boolean containsKey(java.lang.Object key)
containsKey
in interface IHashtable<K,V>
key
- possible keytrue
if and only if the specified object
is a key in the hashtable, false
otherwisepublic boolean containsValue(java.lang.Object value)
true
if the hashtable maps one or more keys to this value.containsValue
in interface IHashtable<K,V>
value
- value whose presence in the hashtable is to be testedtrue
if the hashtable maps one or more keys to the
specified value, false
otherwisepublic java.util.Enumeration<V> elements()
elements
in interface IHashtable<K,V>
public V get(java.lang.Object key)
get
in interface IHashtable<K,V>
key
- a key in the hashtablenull
if the key is not mapped to any value in
the hashtable.public boolean isEmpty()
isEmpty
in interface IHashtable<K,V>
true
if the hashtable maps no keys to values,
false
otherwisepublic java.util.Enumeration<K> keys()
keys
in interface IHashtable<K,V>
public V put(K key, V value)
key
to the specified
value
in the hashtable. Neither the key
,
nor the value
can be null
.put
in interface IHashtable<K,V>
key
- the hashtable keyvalue
- the valuenull
if it did not have onepublic V remove(java.lang.Object key)
remove
in interface IHashtable<K,V>
key
- the key that needs to be removednull
if the key did not have a mappingpublic int size()
size
in interface IHashtable<K,V>
public java.lang.String toString()
toString
in interface IHashtable<K,V>
toString
in class java.lang.Object
public java.util.Hashtable getHashtable()
java.util.Hashtable
getHashtable
in interface IHashtable<K,V>
java.util.Hashtable
public void setHashtable(java.lang.Object hashtable)
java.util.Hashtable
setHashtable
in interface IHashtable<K,V>
hashtable
- reference to the underlying hashtable. Must be of type java.util.Hashtable
.