Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.squawk.debugger.sda
Class WeakIntHashtable

    java.lang.Object
      com.sun.squawk.util.IntHashtable
          com.sun.squawk.debugger.sda.WeakIntHashtable

    public final class WeakIntHashtable

extends IntHashtable

This class extends an `IntHashtable` in two important ways: 1. It wraps all inserted values in a WeakReference. 2. It compares all (wrapped) values using reference equality as opposed to `Object.equals(java.lang.Object)`.

Field Summary

Fields inherited from class com.sun.squawk.util.IntHashtable
`count, table, threshold`

Constructor Summary
`WeakIntHashtable()` Constructs a new, empty hashtable with a default capacity and load factor.

Method Summary
`void` | `compact()` Removes all the entries whose wrapped objects have been collected or cleared.
`boolean` | `contains(Object value)` Tests if some key maps into the specified value in this hashtable.
`Object` | `get(int key)` Returns the value to which `key` is mapped in this hashtable.
`Integer` | `getKey(Object value)` Gets the key for a given value in this table.
`Object` | `put(int key, Object value)` Maps the specified `key` to the specified `value` in this hashtable.

Methods inherited from class com.sun.squawk.util.IntHashtable
`clear, containsKey, elements, isEmpty, keys, rehash, remove, size, toString, visit`

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

Constructor Detail

### WeakIntHashtable

    public WeakIntHashtable()

  Constructs a new, empty hashtable with a default capacity and load factor.

Method Detail

### contains

    public boolean contains(Object value)

  Tests if some key maps into the specified value in this hashtable. This operation is more expensive than the `containsKey` method.

  This implementation uses reference equality when comparing values.

  Overrides:
    `contains` in class `IntHashtable`
  Parameters:
    `value` - a value to search for.
  Returns:
    `true` if some key maps to the `value` argument in this hashtable; `false` otherwise.
  See Also:
    `Hashtable.containsKey(java.lang.Object)`

### put

    public Object put(int key,
                      Object value)
               throws IllegalArgumentException

  Maps the specified `key` to the specified `value` in this hashtable. Neither the key nor the value can be `null`.

  If `value` is an instanceof `WeakReference`, then it is directly inserted in the table otherwise `value` is wrapped in a `WeakReference` before being inserted. However, value retrieved by calling the `get` method will always be the value within the WeakReference.

  Overrides:
    `put` in class `IntHashtable`
  Parameters:
    `key` - the key
    `value` - the value
  Returns:
    the previous value mapped by `key`
  Throws:
    `IllegalArgumentException` - if `value instanceof WeakReference` and the referent is a WeakReference itself
  See Also:
    `Object.equals(java.lang.Object)`, `Hashtable.get(java.lang.Object)`

### compact

    public void compact()

  Removes all the entries whose wrapped objects have been collected or cleared.

### get

    public Object get(int key)

  Returns the value to which `key` is mapped in this hashtable. This will return null if `key` does not map to a value or the value has been garbage collected.

  Overrides:
    `get` in class `IntHashtable`
  Parameters:
    `key` - the key to search for
  Returns:
    the value corresponding to `key` or null
  See Also:
    `Hashtable.put(java.lang.Object, java.lang.Object)`

### getKey

    public Integer getKey(Object value)

  Gets the key for a given value in this table. Values in the tables are compared against `value` using reference equality as opposed to `Object.equals(java.lang.Object)`.

  Parameters:
    `value` - the value for which the key is requested
  Returns:
    the key for `value` or null if `value` is not in this table

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"