|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Dictionary | +--java.util.Hashtable | +--com.ibm.dse.tools.workbench.base.OrderedHashtable
This class implements an ordered hashtable, which maps keys to values and is able to reorder the entries by access time. The entries will be reordered every time an entry is accessed or inserted.
Inner Class Summary | |
static class |
OrderedHashtable.Entry
Hashtable collision list. |
Constructor Summary | |
OrderedHashtable()
Constructs a new, empty ordered hashtable with a default capacity and load factor, which is 0.75. |
|
OrderedHashtable(int initialCapacity)
Constructs a new, empty ordered hashtable with the specified initial capacity and default load factor, which is 0.75. |
|
OrderedHashtable(int initialCapacity,
float loadFactor)
Constructs a new, empty hashtable with the specified initial capacity, the specified load factor, the maximum capacity and the unloadFactor. |
|
OrderedHashtable(int initialCapacity,
float loadFactor,
int maxCapacity,
float unloadFactor)
Constructs a new, empty ordered hashtable with the specified initial capacity, the specified load factor, the maximum capacity and the unloadFactor. |
|
OrderedHashtable(java.util.Map t)
Constructs a new ordered hashtable with the same mappings as the given Map. |
Method Summary | |
void |
clear()
Clears this ordered hashtable so that it contains no keys. |
java.lang.Object |
clone()
Creates a shallow copy of this ordered hashtable. |
boolean |
contains(java.lang.Object value)
Tests if some key maps into the specified value in this ordered hashtable. |
boolean |
containsKey(java.lang.Object key)
Tests if the specified object is a key in this ordered hashtable. |
boolean |
containsValue(java.lang.Object value)
Returns true if this Hashtable maps one or more keys to this value. |
java.util.Enumeration |
elements()
Returns an enumeration of the values in this ordered hashtable. |
java.util.Set |
entrySet()
Returns a Set view of the entries contained in this Hashtable. |
boolean |
equals(java.lang.Object o)
Compares the specified Object with this Map for equality, as per the definition in the Map interface. |
java.lang.Object |
get(java.lang.Object key)
Returns the value to which the specified key is mapped in this hashtable. |
int |
hashCode()
Returns the hash code value for this Map as per the definition in the Map interface. |
boolean |
isEmpty()
Tests if this hashtable maps no keys to values. |
java.util.Enumeration |
keys()
Returns an enumeration of the keys in this hashtable. |
java.util.Set |
keySet()
Returns a Set view of the keys contained in this ordered Hashtable. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Maps the specified key to the specified
value in this ordered hashtable. |
void |
putAll(java.util.Map t)
Copies all of the mappings from the specified Map to this Hashtable These mappings will replace any mappings that this Hashtable had for any of the keys currently in the specified Map. |
protected void |
rehash()
Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently. |
java.lang.Object |
remove(java.lang.Object key)
Removes the key (and its corresponding value) from this ordered hashtable. |
int |
size()
Returns the number of keys in this ordered hashtable. |
java.lang.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). |
java.util.Collection |
values()
Returns a Collection view of the values contained in this ordered Hashtable. |
Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public OrderedHashtable()
public OrderedHashtable(int initialCapacity)
initialCapacity
- int the initial capacity of the hashtable.public OrderedHashtable(int initialCapacity, float loadFactor)
initialCapacity
- int the initial capacity of the hashtable.loadFactor
- float the load factor of the hashtable.public OrderedHashtable(int initialCapacity, float loadFactor, int maxCapacity, float unloadFactor)
initialCapacity
- int the initial capacity of the hashtable.loadFactor
- float the load factor of the hashtable.maxCapacity
- int the initial capacity of the hashtable.unloadFactor
- float the load factor of the hashtable.public OrderedHashtable(java.util.Map t)
t
- java.util.MapMethod Detail |
public void clear()
public java.lang.Object clone()
public boolean contains(java.lang.Object value)
containsKey
method.Note that this method is identical in functionality to containsValue, (which is part of the Map interface in the collections framework).
value
- java.lang.Object value a value to search for.true
if and only if some key maps to the
value
argument in this hashtable as
determined by the equals method;
false
otherwise.public boolean containsKey(java.lang.Object key)
key
- java.lang.Object possible key.true
if and only if the specified object
is a key in this hashtable, as determined by the
equals method; false
otherwise.public boolean containsValue(java.lang.Object value)
Note that this method is identical in functionality to contains (which predates the Map interface).
value
- java.lang.Object value whose presence in this Hashtable is to be tested.public java.util.Enumeration elements()
public java.util.Set entrySet()
public boolean equals(java.lang.Object o)
public java.lang.Object get(java.lang.Object key)
key
- java.lang.Object a key in the hashtable.null
if the key is not mapped to any value in
this hashtable.public int hashCode()
public boolean isEmpty()
true
if this ordered hashtable maps no keys to values;
false
otherwise.public java.util.Enumeration keys()
public java.util.Set keySet()
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
key
to the specified
value
in this ordered hashtable. Neither the key nor the
value can be null
.
The value can be retrieved by calling the get
method
with a key that is equal to the original key.
key
- java.lang.Object the hashtable key.value
- java.lang.Object the value.null
if it did not have one.null
.public void putAll(java.util.Map t)
t
- java.util.Mapprotected void rehash()
public java.lang.Object remove(java.lang.Object key)
key
- java.lang.Object the key that needs to be removed.null
if the key did not have a mapping.public int size()
public java.lang.String toString()
Overrides to toString method of Object.
public java.util.Collection values()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |