Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

oracle.adfnmc.util.collections
Class OrderedDictionary

java.lang.Object
  extended by oracle.adfnmc.util.collections.OrderedDictionary
All Implemented Interfaces:
Map

public class OrderedDictionary
extends java.lang.Object
implements Map

A Hashtable-like collection which maps keys to values and also maintains the order in which the elements were added.


Nested Class Summary
 
Nested classes/interfaces inherited from interface oracle.adfnmc.java.util.Map
Map.Entry
 
Field Summary
static java.lang.Class CLASS_INSTANCE
           
 
Constructor Summary
OrderedDictionary()
          Create an OrderedDictionary with default capacity
OrderedDictionary(int initialSize)
          Create an OrderedDictionary with the specified initial size
 
Method Summary
 void clear()
          Remove all elements in this collection
 java.lang.Object clone()
           
 boolean contains(java.lang.Object value)
          Does the collection contain the specified value?
 boolean containsKey(java.lang.Object key)
          Does the collection contain the specified key?
 boolean containsValue(java.lang.Object value)
          Searches this Map for the specified value.
 java.lang.Object elementAt(int index)
          Retrieve a value by its index.
 java.util.Enumeration elements()
          Retrieve an iterator over the values in this collection
 Set entrySet()
          Returns a Set whose elements comprise all of the mappings that are to be found in this Map.
 java.lang.Object get(int index)
          An alias for elementAt.
 java.lang.Object get(java.lang.Object key)
          Retrieve a value by its key
 java.util.Enumeration getElements()
           
 int getIndexOfKey(java.lang.Object key)
          Returns the index associated with the given key
 java.lang.Object getKeyOfIndex(int index)
          Returns the key associated with the given index
 java.util.Enumeration getKeys()
           
 void insertElementAt(java.lang.Object value, int index, java.lang.Object key)
          Inserts a new element with a new key at the specified index.
 boolean isEmpty()
          Is the collection empty?
 java.util.Enumeration keys()
          Retrieve an iterator over the keys in this collection
 Set keySet()
          Answers a Set of the keys contained in this Map.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Add a key-value pair
 void putAll(Map map)
          Copies every mapping in the specified Map to this Map.
 java.lang.Object remove(java.lang.Object key)
          Delete the tuple identified by this key
 void removeAllElements()
          An alias for clear.
 void removeElement(int index)
          Delete the tuple identified by this index
 java.lang.Object removeElement(java.lang.Object key)
          Delete the tuple identified by this key
 void replaceElementAt(java.lang.Object value, int index)
          Replaces the element at the specified index.
 void replaceElementAt(java.lang.Object key, java.lang.Object value, int index)
          Replaces both the key and the value at the specified index.
 void resize(int newSize)
          Resize the dictionary to the new size.
 void setElementAt(java.lang.Object value, int index)
          An alias for replaceElementAt.
 void setElementAt(java.lang.Object key, java.lang.Object value, int index)
          An alias for replaceElementAt.
 int size()
          How many elements are in the collection?
 Collection values()
          Returns all of the current Map values in a Collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.adfnmc.java.util.Map
equals, hashCode
 

Field Detail

CLASS_INSTANCE

public static final java.lang.Class CLASS_INSTANCE
Constructor Detail

OrderedDictionary

public OrderedDictionary(int initialSize)
Create an OrderedDictionary with the specified initial size

Parameters:
initialSize - Initial capacity

OrderedDictionary

public OrderedDictionary()
Create an OrderedDictionary with default capacity

Method Detail

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Add a key-value pair

Specified by:
put in interface Map
Parameters:
key -
value -
Returns:
the value of any previous mapping with the specified key or null if there was no mapping

replaceElementAt

public void replaceElementAt(java.lang.Object value,
                             int index)
Replaces the element at the specified index. Note that this does not change the key that has already been inserted at that index; only the value.

Parameters:
value -
index -

setElementAt

public void setElementAt(java.lang.Object value,
                         int index)
An alias for replaceElementAt.

Parameters:
value -
index -

replaceElementAt

public void replaceElementAt(java.lang.Object key,
                             java.lang.Object value,
                             int index)
Replaces both the key and the value at the specified index. Note that the dictionary must already be pre-sized to accommodate the index.

Parameters:
key -
value -
index -

resize

public void resize(int newSize)
Resize the dictionary to the new size. Note that if the new size is less than the old size, elements will be removed.

Parameters:
newSize -

setElementAt

public void setElementAt(java.lang.Object key,
                         java.lang.Object value,
                         int index)
An alias for replaceElementAt.

Parameters:
key -
value -
index -

insertElementAt

public void insertElementAt(java.lang.Object value,
                            int index,
                            java.lang.Object key)
Inserts a new element with a new key at the specified index. All keys with a higher index are shifted accordingly. If this key already exists in the collection, it is first removed and then re-inserted at the specified index.

Parameters:
value -
index -
key -

get

public java.lang.Object get(java.lang.Object key)
Retrieve a value by its key

Specified by:
get in interface Map
Parameters:
key -
Returns:
The value associated with the key, or null if the key does not exist.

elementAt

public java.lang.Object elementAt(int index)
Retrieve a value by its index.

Parameters:
index - Ranges from 0...n, such that the 0th element was the first one added, and the nth was the last.
Returns:
The value associated with this index, or null of index out of range.

get

public java.lang.Object get(int index)
An alias for elementAt.

Parameters:
index -
Returns:

elements

public java.util.Enumeration elements()
Retrieve an iterator over the values in this collection

Returns:
Enumeration

keys

public java.util.Enumeration keys()
Retrieve an iterator over the keys in this collection

Returns:

containsKey

public boolean containsKey(java.lang.Object key)
Does the collection contain the specified key?

Specified by:
containsKey in interface Map
Parameters:
key - Key of interest
Returns:
true if key is found; false otherwise.

contains

public boolean contains(java.lang.Object value)
Does the collection contain the specified value?

Parameters:
value - Value of interest
Returns:
true if value is found; false otherwise

clear

public void clear()
Remove all elements in this collection

Specified by:
clear in interface Map
See Also:
Map.isEmpty(), Map.size()

removeAllElements

public void removeAllElements()
An alias for clear.


size

public int size()
How many elements are in the collection?

Specified by:
size in interface Map
Returns:
# of elements

getIndexOfKey

public int getIndexOfKey(java.lang.Object key)
Returns the index associated with the given key

Parameters:
key - Key of interest
Returns:
Index of key if found; -1 otherwise

getKeyOfIndex

public java.lang.Object getKeyOfIndex(int index)
Returns the key associated with the given index

Parameters:
index - Index of interest
Returns:
Key if found; null otherwise

removeElement

public java.lang.Object removeElement(java.lang.Object key)
Delete the tuple identified by this key

Parameters:
key - Key of interest

removeElement

public void removeElement(int index)
Delete the tuple identified by this index

Parameters:
index - [0...n)

remove

public java.lang.Object remove(java.lang.Object key)
Delete the tuple identified by this key

Specified by:
remove in interface Map
Parameters:
key - Key of interest
Returns:
Object that was removed

isEmpty

public boolean isEmpty()
Is the collection empty?

Specified by:
isEmpty in interface Map
Returns:
true if there are 0 elements in the collection
See Also:
Map.size()

getElements

public java.util.Enumeration getElements()

getKeys

public java.util.Enumeration getKeys()

clone

public java.lang.Object clone()

containsValue

public boolean containsValue(java.lang.Object value)
Description copied from interface: Map
Searches this Map for the specified value.

Specified by:
containsValue in interface Map
Parameters:
value - the object to search for
Returns:
true if value is a value of this Map, false otherwise

entrySet

public Set entrySet()
Description copied from interface: Map
Returns a Set whose elements comprise all of the mappings that are to be found in this Map. Information on each of the mappings is encapsulated in a separate Map.Entry instance. As the Set is backed by this Map, users should be aware that changes in one will be immediately visible in the other.

Specified by:
entrySet in interface Map
Returns:
a Set of the mappings

keySet

public Set keySet()
Description copied from interface: Map
Answers a Set of the keys contained in this Map. The set is backed by this Map so changes to one are reflected by the other. The set does not support adding.

Specified by:
keySet in interface Map
Returns:
a Set of the keys

putAll

public void putAll(Map map)
Description copied from interface: Map
Copies every mapping in the specified Map to this Map.

Specified by:
putAll in interface Map
Parameters:
map - the Map to copy mappings from

values

public Collection values()
Description copied from interface: Map
Returns all of the current Map values in a Collection. As the returned Collection is backed by this Map, users should be aware that changes in one will be immediately visible in the other.

Specified by:
values in interface Map
Returns:
a Collection of the values

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.