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

## org.ensembl.util
Class IDMap

    java.lang.Object
      java.util.AbstractMap
          java.util.HashMap
              org.ensembl.util.IDMap

All Implemented Interfaces:
  java.lang.Cloneable, java.util.Map, java.io.Serializable

public class IDMap
extends java.util.HashMap

A fast hash map providing internalID -> Persistent object mapping. This class is not thread safe.

See Also:
  Serialized Form

Constructor Summary
`IDMap()`
`IDMap(java.util.Iterator iter)` Adds all the persistent objects returned by the iterator using their internalIDs as the keys.
`IDMap(java.util.List values)` Adds all the persistent objects in the list using their internalIDs as the keys.
`IDMap(Persistent[] values)` Creates a map conainting all the persistent objects keyed on their internalIDs.

Method Summary
`java.lang.Object` | `get(long key)` Retrieves the item using get(new Long(key)).
`void` | `put(long key, java.lang.Object value)` Stores the object using new Long(key) as it's key.
`boolean` | `put(Persistent value)` Stores the persistent object using it's internalID as the key.
`void` | `putAll(java.util.Iterator iter)` Stores the persistent objects using their internalIDs as the keys.
`void` | `putAll(java.util.List values)` Adds all the persistent objects using their internalIDs as the keys.
`void` | `putAll(Persistent[] values)` Adds all the persistent objects using their internalIDs as the keys.

Methods inherited from class java.util.HashMap
`clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values`

Methods inherited from class java.util.AbstractMap
`equals, hashCode, toString`

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

Methods inherited from interface java.util.Map
`equals, hashCode`

Constructor Detail

### IDMap

    public IDMap(java.util.Iterator iter)

  Adds all the persistent objects returned by the iterator using their internalIDs as the keys.

Parameters:
  `iter` - iterator over Persistent objects to be stored.
Throws:
  `java.lang.ClassCastException` - if anything other Persistent objects are in the list.

### IDMap

    public IDMap(java.util.List values)

  Adds all the persistent objects in the list using their internalIDs as the keys. Implementation uses values.get(i) to access the list items. If it is more efficient to to access the list using an iterator consider using IDMap(Iterator) instead.

Parameters:
  `values` - list of Persistent objects to be stored.
Throws:
  `java.lang.ClassCastException` - if anything other Persistent objects are in the list.
See Also:
  `IDMap(Iterator)`

### IDMap

    public IDMap(Persistent[] values)

  Creates a map conainting all the persistent objects keyed on their internalIDs.

Parameters:
  `values` - Persistent objects to be stored.
Throws:
  `java.lang.ClassCastException` - if anything other Persistent objects are in the list.

### IDMap

    public IDMap()

Method Detail

### get

    public java.lang.Object get(long key)

  Retrieves the item using get(new Long(key)).

  Parameters:
    `key` - key for value in map.
  Returns:
    value if present, otherwise null.

### put

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

  Stores the object using new Long(key) as it's key.

  Parameters:
    `key` - key for value in map.
    `value` - value to be stored.

### put

    public boolean put(Persistent value)

  Stores the persistent object using it's internalID as the key.

  Parameters:
    `value` - value to be stored.
  Returns:
    true, value is always added, replaces pervious item with same internalID if necessary.

### putAll

    public void putAll(java.util.Iterator iter)

  Stores the persistent objects using their internalIDs as the keys.

  Parameters:
    `iter` - iterator over Persistent objects to be stored.
  Throws:
    `java.lang.ClassCastException` - if anything other Persistent objects are in the list.

### putAll

    public void putAll(java.util.List values)

  Adds all the persistent objects using their internalIDs as the keys. Uses values.get(i) to access the list items.

  Parameters:
    `values` - list of Persistent objects to be stored.
  Throws:
    `java.lang.ClassCastException` - if anything other Persistent objects are in the list.

### putAll

    public void putAll(Persistent[] values)

  Adds all the persistent objects using their internalIDs as the keys.

  Parameters:
    `values` - objects to be stored.
  Throws:
    `java.lang.ClassCastException` - if anything other Persistent objects are in the list.

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