Package org.mozilla.javascript
Class ObjToIntMap
java.lang.Object
org.mozilla.javascript.ObjToIntMap
- All Implemented Interfaces:
Serializable
Map to associate objects to integers.
The map does not synchronize any of its operation, so either use
it from a single thread or do own synchronization or perform all mutation
operations on one thread before passing the map to others
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
int
Get integer value assigned with key.int
getExisting
(Object key) Get integer value assigned with key.Object[]
getKeys()
Return array of present keysvoid
boolean
If table already contains a key that equals to keyArg, return that key while setting its value to zero, otherwise add keyArg with 0 value to the table and return it.boolean
isEmpty()
void
void
int
size()
-
Constructor Details
-
ObjToIntMap
public ObjToIntMap() -
ObjToIntMap
public ObjToIntMap(int keyCountHint)
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
size
public int size() -
has
-
get
Get integer value assigned with key.- Returns:
- key integer value or defaultValue if key is absent
-
getExisting
Get integer value assigned with key.- Returns:
- key integer value
- Throws:
RuntimeException
- if key does not exist
-
put
-
intern
If table already contains a key that equals to keyArg, return that key while setting its value to zero, otherwise add keyArg with 0 value to the table and return it. -
remove
-
clear
public void clear() -
newIterator
-
getKeys
Return array of present keys -
getKeys
-