Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2006 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.collab.util
Class ArrayMap

    java.lang.Object
      java.util.AbstractMap
          com.compoze.collab.util.ArrayMap

All Implemented Interfaces
  Serializable, Map

    public class ArrayMap

extends AbstractMap
implements Serializable

Implements a `Map` that's backed by an array. This implementation provides all of the optional `Map` operations and permits `null` values but does not permit the `null` key.
This implementation is not thread safe, so use of it from multiple threads without external synchronization will result in undefined behavior.
This `Map` implementation may provide improved performance over `HashMap` when used for fewer than 5 mappings. It also consumes less of the Java heap than `HashMap`. You should test this class with the keys and values that you're using to truly evaluate the performance of both heap and CPU in your real-world scenario, and use it only when the benefit is clear.

See Also
  Serialized Form

Constructor Summary
`ArrayMap()` Constructs an empty `ArrayMap` with the default initial capacity (5).
`ArrayMap(int iInitialCapacity)` Constructs an empty `ArrayMap` with the specified initial capacity.
`ArrayMap(Map map)` Constructs an empty `ArrayMap` with the same mappings as the specified `Map`.

Method Summary
`void` | `clear()` Removes all mappings from this map.
`boolean` | `containsKey(Object key)` Returns `true` if this map contains a mapping for the specified key.
`boolean` | `containsValue(Object value)` Returns `true` if this map contains at least one value that is the same as the specified value.
`Set` | `entrySet()` Returns a set view of the mappings contained in this map.
`Object` | `get(Object key)` Returns the value to which this map maps the specified key.
`boolean` | `isEmpty()` Determines if the map is empty.
`Set` | `keySet()` Returns a set view of the keys contained in this map.
`static void` | `main(String[] args)` Exerciser.
`Object` | `put(Object key, Object value)` Associates the specified value with the specified key in this map.
`void` | `putUnique(Object key, Object value)` Associates the specified value with the specified key in this map, assuming that the specified key is known to be unique.
`Object` | `remove(Object key)` Removes the mapping for this key from this map if it is present.
`int` | `size()` Gets the number of mappings in the map.
`Collection` | `values()` Returns a collection view of the values contained in this map.

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

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

Constructor Detail

### ArrayMap

    public ArrayMap()

  Constructs an empty `ArrayMap` with the default initial capacity (5).

### ArrayMap

    public ArrayMap(int iInitialCapacity)

  Constructs an empty `ArrayMap` with the specified initial capacity.

  Parameters
    `iInitialCapacity` - the initial capacity

### ArrayMap

    public ArrayMap(Map map)

  Constructs an empty `ArrayMap` with the same mappings as the specified `Map`.

  Parameters
    `map` - the `Map` whose mappings are to be placed in this `Map`(must not be `null`)``

Method Detail

### clear

    public void clear()

  Removes all mappings from this map.

  Specified by:
    `clear` in interface `Map`
  Overrides:
    `clear` in class `AbstractMap`
  See Also
    `Map.clear()`

### containsKey

    public boolean containsKey(Object key)

  Returns `true` if this map contains a mapping for the specified key.

  Specified by:
    `containsKey` in interface `Map`
  Overrides:
    `containsKey` in class `AbstractMap`
  Returns
    `true` if there is a mapping, `false` otherwise (must not be `null`)
  See Also
    `Map.containsKey(Object)`

### containsValue

    public boolean containsValue(Object value)

  Returns `true` if this map contains at least one value that is the same as the specified value.

  Specified by:
    `containsValue` in interface `Map`
  Overrides:
    `containsValue` in class `AbstractMap`
  Returns
    `true` if it contains the value, `false` otherwise (may be `null`)
  See Also
    `Map.containsValue(Object)`

### entrySet

    public Set entrySet()

  Returns a set view of the mappings contained in this map.

  Specified by:
    `entrySet` in interface `Map`
  Specified by:
    `entrySet` in class `AbstractMap`
  Returns
    the `Set` (each element in the set is a `Map.Entry`)
  See Also
    `Map.entrySet()`

### get

    public Object get(Object key)

  Returns the value to which this map maps the specified key.

  Specified by:
    `get` in interface `Map`
  Overrides:
    `get` in class `AbstractMap`
  Parameters
    `the` - key (must not be `null`)
  Returns
    the value to which this map maps the specified key
  See Also
    `Map.get(Object)`

### isEmpty

    public boolean isEmpty()

  Determines if the map is empty.

  Specified by:
    `isEmpty` in interface `Map`
  Overrides:
    `isEmpty` in class `AbstractMap`
  Returns
    `true` if the map is empty, `false` otherwise
  See Also
    `Map.isEmpty()`

### keySet

    public Set keySet()

  Returns a set view of the keys contained in this map.

  Specified by:
    `keySet` in interface `Map`
  Overrides:
    `keySet` in class `AbstractMap`
  Returns
    the key set
  See Also
    `Map.keySet()`

### put

    public Object put(Object key,
                      Object value)

  Associates the specified value with the specified key in this map.

  Specified by:
    `put` in interface `Map`
  Overrides:
    `put` in class `AbstractMap`
  Parameters
    `key` - the key (must not be `null`)
    `value` - the value (may be `null`)
  Returns
    any existing value that was replaced, or `null` if the value was not already in the `Map`
  See Also
    `Map.put(Object, Object)`

### putUnique

    public void putUnique(Object key,
                          Object value)

  Associates the specified value with the specified key in this map, assuming that the specified key is known to be unique. This method may offer a performance benefit since it does not need to check all keys for uniqueness. If the key is not unique then all other `Map` operations will be undefined after this method is called.

  Parameters
    `key` - the key (must not be `null`)
    `value` - the value (may be `null`)
  See Also
    `Map.put(Object, Object)`

### remove

    public Object remove(Object key)

  Removes the mapping for this key from this map if it is present.

  Specified by:
    `remove` in interface `Map`
  Overrides:
    `remove` in class `AbstractMap`
  Parameters
    `key` - the key of the mapping to remove (must not be `null`)
  Returns
    the existing value, or `null` if there was no value
  See Also
    `Map.remove(Object)`

### size

    public int size()

  Gets the number of mappings in the map.

  Specified by:
    `size` in interface `Map`
  Overrides:
    `size` in class `AbstractMap`
  Returns
    the number of mappings (0 if there are no mappings)
  See Also
    `Map.size()`

### values

    public Collection values()

  Returns a collection view of the values contained in this map.

  Specified by:
    `values` in interface `Map`
  Overrides:
    `values` in class `AbstractMap`
  Returns
    the collection

### main

    public static void main(String[] args)

  Exerciser.

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

Copyright © 2006 BEA Systems, Inc. All Rights Reserved