|
Oracle Fusion Middleware Java API Reference for Oracle Data Visualization Components 11g Release 2 (11.1.2.2.0) E17492-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.util.AbstractMap<K,V>
oracle.dss.util.ArrayMap<K,V>
public class ArrayMap<K,V>
A Map implementation that stores its contents in a single array. This approach is significantly faster for small sets of data than the use of a HashMap or Hashtable, though potentially much slower for very large sets.
ArrayMap is optimized for many-reads-few-write. In particular, it reallocates its array on any insertion or deletion.
ArrayMap also includes a series of static methods for managing the Object array. These may be used in place of instantiating an ArrayMap for clients that don't need a Map implementation. Clients using these methods must be careful to store the returned Object array on any mutator method. They also must provide their own synchronization, if needed. When using these static methods, clients can opt to search for objects by identity (via getByIdentity()
) instead of equality, while the static get()
method will try identity before equality. This latter approach is extremely fast but still safe for retrieval of Strings that have all been interned, especially if misses are infrequent (since misses do require a scan using Object.equals()). It's worth remembering that String constants are always interned, as required by the language specification.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Constructor Summary | |
---|---|
ArrayMap() Creates an empty ArrayMap, preallocating nothing. |
|
ArrayMap(int size) Creates an ArrayMap, preallocating for a certain size. |
|
ArrayMap(int size, int increment) Creates an ArrayMap, preallocating for a certain size. |
Method Summary | |
---|---|
void |
clear() Removes all elements from the ArrayMap. |
java.lang.Object |
clone() Clones the map. |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
V |
get(java.lang.Object key) |
static java.lang.Object |
get(java.lang.Object[] array, java.lang.Object key) Gets the object stored with the given key. |
static java.lang.Object |
getByEquality(java.lang.Object[] array, java.lang.Object key) Gets the object stored with the given key, using only object equality. |
V |
getByIdentity(java.lang.Object key) |
static java.lang.Object |
getByIdentity(java.lang.Object[] array, java.lang.Object key) Gets the object stored with the given key, using only object identity. |
K |
getKey(int index) Returns the key at a specific index in the map. |
static java.util.Enumeration<java.lang.Object> |
getKeys(java.lang.Object[] array) Returns an Iterator of keys in the array. |
V |
getValue(int index) Returns the value at a specific index in the map. |
static java.util.Enumeration<java.lang.Object> |
getValues(java.lang.Object[] array) Returns an Iterator of values in the array. |
java.util.Enumeration<K> |
keys() Returns an enumeration of the keys in this map. |
V |
put(K key, V value) |
static java.lang.Object[] |
put(java.lang.Object[] array, java.lang.Object key, java.lang.Object value) Adds the key/value pair to the array, returning a new array if necessary. |
V |
remove(java.lang.Object key) |
static java.lang.Object[] |
remove(java.lang.Object[] array, java.lang.Object key) Removes the value for the key from the array, returning a new array if necessary. |
static java.lang.Object[] |
remove(java.lang.Object[] array, java.lang.Object key, boolean reallocate) Removes the value for the key from the array, returning a new array if necessary. |
int |
size() |
Methods inherited from class java.util.AbstractMap |
---|
equals, hashCode, isEmpty, keySet, putAll, toString, values |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ArrayMap()
public ArrayMap(int size)
size
- the number of elements to pre-allocate forpublic ArrayMap(int size, int increment)
size
- the number of elements to pre-allocate forincrement
- the number of additional elements to allocate for when overruningMethod Detail |
---|
public K getKey(int index)
public V getValue(int index)
public static java.lang.Object get(java.lang.Object[] array, java.lang.Object key)
public static java.lang.Object getByIdentity(java.lang.Object[] array, java.lang.Object key)
public static java.lang.Object getByEquality(java.lang.Object[] array, java.lang.Object key)
public static java.lang.Object[] put(java.lang.Object[] array, java.lang.Object key, java.lang.Object value)
public static java.lang.Object[] remove(java.lang.Object[] array, java.lang.Object key)
public static java.lang.Object[] remove(java.lang.Object[] array, java.lang.Object key, boolean reallocate)
public int size()
size
in interface java.util.Map<K,V>
size
in class java.util.AbstractMap<K,V>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<K,V>
containsValue
in class java.util.AbstractMap<K,V>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<K,V>
containsKey
in class java.util.AbstractMap<K,V>
public java.util.Enumeration<K> keys()
public static java.util.Enumeration<java.lang.Object> getKeys(java.lang.Object[] array)
public static java.util.Enumeration<java.lang.Object> getValues(java.lang.Object[] array)
public java.lang.Object clone()
clone
in class java.util.AbstractMap<K,V>
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
entrySet
in interface java.util.Map<K,V>
entrySet
in class java.util.AbstractMap<K,V>
public V get(java.lang.Object key)
get
in interface java.util.Map<K,V>
get
in class java.util.AbstractMap<K,V>
public V getByIdentity(java.lang.Object key)
public V put(K key, V value)
put
in interface java.util.Map<K,V>
put
in class java.util.AbstractMap<K,V>
public V remove(java.lang.Object key)
remove
in interface java.util.Map<K,V>
remove
in class java.util.AbstractMap<K,V>
public void clear()
clear
in interface java.util.Map<K,V>
clear
in class java.util.AbstractMap<K,V>
|
Oracle Fusion Middleware Java API Reference for Oracle Data Visualization Components 11g Release 2 (11.1.2.2.0) E17492-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |