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

E17503-02

oracle.adfnmc.java.util
Class LinkedHashMap

java.lang.Object
  extended by oracle.adfnmc.java.util.AbstractMap
      extended by oracle.adfnmc.java.util.HashMap
          extended by oracle.adfnmc.java.util.LinkedHashMap
All Implemented Interfaces:
Serializable, Cloneable, Map

public class LinkedHashMap
extends HashMap

LinkedHashMap is a variant on HashMap. Its entries are kept in a doubly-linked list. The iteration order is, by default, the order in which keys were inserted.

If the three argument constructor is used, and order is specified as true, the iteration would be in the order that entries were accessed. The access order gets affected by put(), get(), putAll() operations, but not by operations on the collection views.

Null elements are allowed, and all the optional Map operations are supported.

Since:
1.4

Constructor Summary
LinkedHashMap()
          Constructs a new empty instance of LinkedHashMap.
LinkedHashMap(int s)
          Constructor with specified size.
LinkedHashMap(int s, float lf)
          Constructor with specified size and load factor.
LinkedHashMap(int s, float lf, boolean order)
          Constructor with specified size, load factor and access order
LinkedHashMap(Map m)
          Constructor with input map
 
Method Summary
 void clear()
          Removes all mappings from this HashMap, leaving it empty.
 java.lang.Object clone()
          Answers a new HashMap with the same mappings and size as this HashMap.
 boolean containsValue(java.lang.Object value)
          Searches this map for the specified value.
 Set entrySet()
          Answers a Set of the mappings contained in this HashMap.
 java.lang.Object get(java.lang.Object key)
          Retrieve the map value corresponding to the given key.
 Set keySet()
          Answers a Set of the keys contained in this HashMap.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Set the mapped value for the given key to the given value.
 java.lang.Object remove(java.lang.Object key)
          Remove the entry corresponding to the given key.
protected  boolean removeEldestEntry(Map.Entry eldest)
          This method is queried from the put and putAll methods to check if the eldest member of the map should be deleted before adding the new member.
 Collection values()
          Answers a Collection of the values contained in this HashMap.
 
Methods inherited from class oracle.adfnmc.java.util.HashMap
containsKey, isEmpty, putAll, putAll, size
 
Methods inherited from class oracle.adfnmc.java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.adfnmc.java.util.Map
equals, hashCode
 

Constructor Detail

LinkedHashMap

public LinkedHashMap()
Constructs a new empty instance of LinkedHashMap.


LinkedHashMap

public LinkedHashMap(int s)
Constructor with specified size.

Parameters:
s - Size of LinkedHashMap required

LinkedHashMap

public LinkedHashMap(int s,
                     float lf)
Constructor with specified size and load factor.

Parameters:
s - Size of LinkedHashMap required
lf - Load factor

LinkedHashMap

public LinkedHashMap(int s,
                     float lf,
                     boolean order)
Constructor with specified size, load factor and access order

Parameters:
s - Size of LinkedHashmap required
lf - Load factor
order - If true indicates that traversal order should begin with most recently accessed

LinkedHashMap

public LinkedHashMap(Map m)
Constructor with input map

Parameters:
m - Input map
Method Detail

containsValue

public boolean containsValue(java.lang.Object value)
Searches this map for the specified value.

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

get

public java.lang.Object get(java.lang.Object key)
Retrieve the map value corresponding to the given key.

Specified by:
get in interface Map
Overrides:
get in class HashMap
Parameters:
key - Key value
Returns:
mapped value or null if the key is not in the map

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Set the mapped value for the given key to the given value.

Specified by:
put in interface Map
Overrides:
put in class HashMap
Parameters:
key - Key value
value - New mapped value
Returns:
The old value if the key was already in the map or null otherwise.

entrySet

public Set entrySet()
Answers a Set of the mappings contained in this HashMap. Each element in the set is a Map.Entry. The set is backed by this HashMap so changes to one are reflected by the other. The set does not support adding.

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

keySet

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

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

values

public Collection values()
Answers a Collection of the values contained in this HashMap. The collection is backed by this HashMap so changes to one are reflected by the other. The collection does not support adding.

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

remove

public java.lang.Object remove(java.lang.Object key)
Remove the entry corresponding to the given key.

Specified by:
remove in interface Map
Overrides:
remove in class HashMap
Parameters:
key - the key
Returns:
the value associated with the key or null if the key was no in the map

removeEldestEntry

protected boolean removeEldestEntry(Map.Entry eldest)
This method is queried from the put and putAll methods to check if the eldest member of the map should be deleted before adding the new member. If this map was created with accessOrder = true, then the result of removeEldesrEntry is assumed to be false.

Parameters:
eldest -
Returns:
true if the eldest member should be removed

clear

public void clear()
Removes all mappings from this HashMap, leaving it empty.

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

clone

public java.lang.Object clone()
Description copied from class: HashMap
Answers a new HashMap with the same mappings and size as this HashMap.

Overrides:
clone in class HashMap
Returns:
a shallow copy of this HashMap
See Also:
Cloneable

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.