Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mozilla.javascript
Class ObjToIntMap

    java.lang.Object
      org.mozilla.javascript.ObjToIntMap

All Implemented Interfaces:
  java.io.Serializable

    public class ObjToIntMap

extends java.lang.Object
implements java.io.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

Author:
  Igor Bukanov
See Also:
  Serialized Form

Nested Class Summary
`static class` | `ObjToIntMap.Iterator`

Constructor Summary
`ObjToIntMap()`
`ObjToIntMap(int keyCountHint)`

Method Summary
`void` | `clear()`
`int` | `get(java.lang.Object key, int defaultValue)` Get integer value assigned with key.
`int` | `getExisting(java.lang.Object key)` Get integer value assigned with key.
`java.lang.Object[]` | `getKeys()` Return array of present keys
`void` | `getKeys(java.lang.Object[] array, int offset)`
`boolean` | `has(java.lang.Object key)`
`java.lang.Object` | `intern(java.lang.Object keyArg)` 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()`
`ObjToIntMap.Iterator` | `newIterator()`
`void` | `put(java.lang.Object key, int value)`
`void` | `remove(java.lang.Object key)`
`int` | `size()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ObjToIntMap

    public ObjToIntMap()

### ObjToIntMap

    public ObjToIntMap(int keyCountHint)

Method Detail

### isEmpty

    public boolean isEmpty()

### size

    public int size()

### has

    public boolean has(java.lang.Object key)

### get

    public int get(java.lang.Object key,
                   int defaultValue)

  Get integer value assigned with key.

  Returns:
    key integer value or defaultValue if key is absent

### getExisting

    public int getExisting(java.lang.Object key)

  Get integer value assigned with key.

  Returns:
    key integer value
  Throws:
    `java.lang.RuntimeException` - if key does not exist

### put

    public void put(java.lang.Object key,
                    int value)

### intern

    public java.lang.Object intern(java.lang.Object keyArg)

  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

    public void remove(java.lang.Object key)

### clear

    public void clear()

### newIterator

    public ObjToIntMap.Iterator newIterator()

### getKeys

    public java.lang.Object[] getKeys()

  Return array of present keys

### getKeys

    public void getKeys(java.lang.Object[] array,
                        int offset)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD