Class Hashtable
java.lang.Object
org.mozilla.javascript.Hashtable
- All Implemented Interfaces:
Serializable, Iterable<Hashtable.Entry>
This generic hash table class is used by Set and Map. It uses a standard HashMap for storing keys
and values so that we can handle lots of hash collisions if necessary, and a doubly-linked list
to support the iterator capability.
This second one is important because JavaScript handling of the iterator is completely different from the way that Java does it. In Java an attempt to modify a collection on a HashMap or LinkedHashMap while iterating through it (except by using the "remove" method on the Iterator object itself) results in a ConcurrentModificationException. JavaScript Maps and Sets explicitly allow the collection to be modified, or even cleared completely, while iterators exist, and even lets an iterator keep on iterating on a collection that was empty when it was created..
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
One entry in the hash table.private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Hashtable.Entry
private Hashtable.Entry
private final HashMap
<Object, Hashtable.Entry> private static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Deprecated.use deleteEntry(Object key) instead because this returns null if the entry was not found or the value of the entry is nullboolean
deleteEntry
(Object key) Deprecated.use getEntry(Object key) instead because this returns null if the entry was not found or the value of the entry is nullboolean
iterator()
private static Hashtable.Entry
void
int
size()
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
map
-
first
-
last
-
-
Constructor Details
-
Hashtable
public Hashtable()
-
-
Method Details
-
makeDummy
-
size
public int size() -
put
-
get
-
getEntry
-
has
-
delete
-
deleteEntry
-
clear
public void clear() -
iterator
- Specified by:
iterator
in interfaceIterable<Hashtable.Entry>
-