public class Hashtable extends Dictionary implements Cloneable, Serializable, Map
serialVersionUID| Constructor and Description |
|---|
Hashtable()
Constructs a new hashtable with the default initial capacity
and a default load factor of 0.75
|
Hashtable(int initialCapacity)
Constructs a new hashtable with the specified initial capacity
and a default load factor of 0.75
|
Hashtable(int initialCapacity,
float loadFactor)
Constructs a hashtable with the specified initial
capacity and the specified load factor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Remove all entries from this Map (optional operation).
|
Object |
clone()
Create a field for field copy of this Object if this Object
implements the Cloneable interface.
|
boolean |
contains(Object value) |
boolean |
containsKey(Object key)
Returns true if this contains a mapping for the given key.
|
boolean |
containsValue(Object value)
Returns true if this contains at least one mapping with the given value.
|
Enumeration |
elements()
Returns an Enumeration of the values in this Dictionary.
|
Set |
entrySet()
Returns a set view of the mappings in this Map.
|
Object |
get(Object key)
Returns the value associated with the supplied key, or null
if no such value exists.
|
boolean |
isEmpty()
Returns true when there are no elements in this Dictionary.
|
Enumeration |
keys()
Returns an Enumeration of the keys in this Dictionary
|
Set |
keySet()
Returns a set view of the keys in this Map.
|
Object |
put(Object key,
Object value)
Inserts a new value into this Dictionary, located by the
supplied key.
|
void |
putAll(Map m)
Copies all entries of the given map to this one (optional operation).
|
protected void |
rehash() |
Object |
remove(Object key)
Removes from the Dictionary the value located by the given key.
|
int |
size()
Returns the number of values currently in this Dictionary.
|
String |
toString()
Returns a string representation of this Hashtable object
in the form of a set of entries, enclosed in braces and separated
by the ASCII characters ", " (comma and space).
|
Collection |
values()
Returns a collection (or bag) view of the values in this Map.
|
public Hashtable(int initialCapacity,
float loadFactor)
public Hashtable(int initialCapacity)
public Hashtable()
public Object clone()
Objectpublic int size()
Dictionarysize in interface Mapsize in class Dictionarypublic boolean isEmpty()
DictionaryisEmpty in interface MapisEmpty in class Dictionarysize() == 0public boolean contains(Object value)
public boolean containsKey(Object key)
MapcontainsKey in interface Mapkey - the key to search forpublic Object remove(Object key)
Dictionaryremove in interface Mapremove in class Dictionarykey - the key used to locate the value to be removedpublic Object put(Object key, Object value)
Dictionaryput in interface Mapput in class Dictionarykey - the key which locates the valuevalue - the value to put into the DictionaryDictionary.get(Object)public void clear()
Mappublic Object get(Object key)
Dictionaryget in interface Mapget in class Dictionarykey - the key to use to fetch the valueDictionary.put(Object, Object)protected void rehash()
public Enumeration elements()
Dictionaryelements in class DictionaryDictionary.keys()public Enumeration keys()
Dictionarykeys in class DictionaryDictionary.elements()public String toString()
public boolean containsValue(Object value)
Map(value == null ? v == null : value.equals(v)). This usually
requires linear time.containsValue in interface Mapvalue - the value to search forpublic Set entrySet()
MapIterator.remove, Set.remove,
removeAll, retainAll, and clear.
Element addition, via add or addAll, is
not supported via this set.public Set keySet()
MapIterator.remove, Set.remove,
removeAll, retainAll, and clear.
Element addition, via add or addAll, is
not supported via this set.public void putAll(Map m)
MapputAll in interface Mapm - the mapping to load into this mapMap.put(Object, Object)public Collection values()
MapIterator.remove,
Collection.remove, removeAll,
retainAll, and clear. Element addition, via
add or addAll, is not supported via this
collection.