org.ws4d.java.structures
Class LinkedMap

java.lang.Object
  extended by org.ws4d.java.structures.HashMap
      extended by org.ws4d.java.structures.LinkedMap

public class LinkedMap
extends HashMap

Class memorizes the order in which objects were inserted. Iterators of the sets returned by this map will have the same sequence. Inserting an already existing entry into the map won't change the order of the elements. Behavior can be extended so that accessing a entry of the map will move this entry to the end of the sequence.


Constructor Summary
LinkedMap()
          Constructor.
LinkedMap(boolean accessOrdering)
          Constructor.
LinkedMap(HashMap m)
          Constructor will create a clone of the specified map.
LinkedMap(int initialCapacity)
          Constructor with initial capacity to specify.
LinkedMap(int initialCapacity, boolean accessOrdering)
          Constructor with initial capacity to specify.
 
Method Summary
 void clear()
           
 boolean containsValue(java.lang.Object value)
           
 Set entrySet()
           
 java.lang.Object get(int index)
           
 java.lang.Object get(java.lang.Object key)
          Get associated value to given key.
 Set keySet()
           
 java.lang.Object remove(int index)
           
 java.lang.Object removeFirst()
           
 java.lang.Object removeLast()
           
 DataStructure values()
           
 
Methods inherited from class org.ws4d.java.structures.HashMap
containsKey, equals, hashCode, isEmpty, put, putAll, remove, size, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkedMap

public LinkedMap()
Constructor.


LinkedMap

public LinkedMap(boolean accessOrdering)
Constructor. If accessOrdering is true, then accessing entries by the get()-method will moved it to the end of the iterator sequences.

Parameters:
initialCapacity - initial capacity to reserve
accessOrdering -

LinkedMap

public LinkedMap(int initialCapacity)
Constructor with initial capacity to specify.

Parameters:
initialCapacity -

LinkedMap

public LinkedMap(int initialCapacity,
                 boolean accessOrdering)
Constructor with initial capacity to specify. If accessOrdering is true, then accessing entries by the get()-method will moved it to the end of the iterator sequences.

Parameters:
initialCapacity - initial capacity to reserve
accessOrdering -

LinkedMap

public LinkedMap(HashMap m)
Constructor will create a clone of the specified map.

Parameters:
m - map to clone.
Method Detail

clear

public void clear()
Overrides:
clear in class HashMap

containsValue

public boolean containsValue(java.lang.Object value)
Overrides:
containsValue in class HashMap

get

public java.lang.Object get(java.lang.Object key)
Description copied from class: HashMap
Get associated value to given key. A key == null will always return null;

Overrides:
get in class HashMap
Parameters:
key - the key to lookup
Returns:
the value for the given key or null

get

public java.lang.Object get(int index)

remove

public java.lang.Object remove(int index)

removeFirst

public java.lang.Object removeFirst()

removeLast

public java.lang.Object removeLast()

entrySet

public Set entrySet()
Overrides:
entrySet in class HashMap

keySet

public Set keySet()
Overrides:
keySet in class HashMap

values

public DataStructure values()
Overrides:
values in class HashMap