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

E17503-02

oracle.adfnmc.java.util
Class AbstractMap

java.lang.Object
  extended by oracle.adfnmc.java.util.AbstractMap
All Implemented Interfaces:
Map
Direct Known Subclasses:
HashMap, TreeMap, WeakHashMap

public abstract class AbstractMap
extends java.lang.Object
implements Map

AbstractMap is an abstract implementation of the Map interface. This implementation does not support adding. A subclass must implement the abstract method entrySet().

Since:
1.2

Nested Class Summary
 
Nested classes/interfaces inherited from interface oracle.adfnmc.java.util.Map
Map.Entry
 
Constructor Summary
protected AbstractMap()
          Constructs a new instance of this AbstractMap.
 
Method Summary
 void clear()
          Removes all elements from this Map, leaving it empty.
protected  java.lang.Object clone()
          Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
 boolean containsKey(java.lang.Object key)
          Searches this Map for the specified key.
 boolean containsValue(java.lang.Object value)
          Searches this Map for the specified value.
abstract  Set entrySet()
          Returns a Set of Map.Entrys that represent the entries in this Map.
 boolean equals(java.lang.Object object)
          Compares the specified object to this Map and answer if they are equal.
 java.lang.Object get(java.lang.Object key)
          Answers the value of the mapping with the specified key.
 int hashCode()
          Answers an integer hash code for the receiver.
 boolean isEmpty()
          Answers if this Map has no elements, a size of zero.
 Set keySet()
          Answers a Set of the keys contained in this Map.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Maps the specified key to the specified value.
 void putAll(Map map)
          Copies every mapping in the specified Map to this Map.
 java.lang.Object remove(java.lang.Object key)
          Removes a mapping with the specified key from this Map.
 int size()
          Answers the number of elements in this Map.
 java.lang.String toString()
          Answers the string representation of this Map.
 Collection values()
          Answers a collection of the values contained in this map.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractMap

protected AbstractMap()
Constructs a new instance of this AbstractMap.

Method Detail

clear

public void clear()
Removes all elements from this Map, leaving it empty.

Specified by:
clear in interface Map
Throws:
java.lang.UnsupportedOperationException - when removing from this Map is not supported
See Also:
isEmpty(), size()

containsKey

public boolean containsKey(java.lang.Object key)
Searches this Map for the specified key.

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

containsValue

public boolean containsValue(java.lang.Object value)
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 abstract Set entrySet()
Returns a Set of Map.Entrys that represent the entries in this Map. Making changes to this Set will change the original Map and vice-versa. Entries can be removed from the Set, or their values can be changed, but new entries cannot be added to the Set.

Specified by:
entrySet in interface Map
Returns:
a Set of Map.Entrys representing the entries in this Map

equals

public boolean equals(java.lang.Object object)
Compares the specified object to this Map and answer if they are equal. The object must be an instance of Map and contain the same key/value pairs.

Specified by:
equals in interface Map
Overrides:
equals in class java.lang.Object
Parameters:
object - the object to compare with this object
Returns:
true if the specified object is equal to this Map, false otherwise
See Also:
hashCode()

get

public java.lang.Object get(java.lang.Object key)
Answers the value of the mapping with the specified key.

Specified by:
get in interface Map
Parameters:
key - the key
Returns:
the value of the mapping with the specified key

hashCode

public int hashCode()
Answers an integer hash code for the receiver. Objects which are equal answer the same value for this method.

Specified by:
hashCode in interface Map
Overrides:
hashCode in class java.lang.Object
Returns:
the receiver's hash
See Also:
equals(java.lang.Object)

isEmpty

public boolean isEmpty()
Answers if this Map has no elements, a size of zero.

Specified by:
isEmpty in interface Map
Returns:
true if this Map has no elements, false otherwise
See Also:
size()

keySet

public Set keySet()
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

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Maps the specified key to the specified value.

Specified by:
put in interface Map
Parameters:
key - the key
value - the value
Returns:
the value of any previous mapping with the specified key or null if there was no mapping
Throws:
java.lang.UnsupportedOperationException - when adding to this Map is not supported
java.lang.ClassCastException - when the class of the key or value is inappropriate for this Map
java.lang.IllegalArgumentException - when the key or value cannot be added to this Map
java.lang.NullPointerException - when the key or value is null and this Map does not support null keys or values

putAll

public void putAll(Map 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
Throws:
java.lang.UnsupportedOperationException - when adding to this Map is not supported
java.lang.ClassCastException - when the class of a key or value is inappropriate for this Map
java.lang.IllegalArgumentException - when a key or value cannot be added to this Map
java.lang.NullPointerException - when a key or value is null and this Map does not support null keys or values

remove

public java.lang.Object remove(java.lang.Object key)
Removes a mapping with the specified key from this Map.

Specified by:
remove in interface Map
Parameters:
key - the key of the mapping to remove
Returns:
the value of the removed mapping or null if key is not a key in this Map
Throws:
java.lang.UnsupportedOperationException - when removing from this Map is not supported

size

public int size()
Answers the number of elements in this Map.

Specified by:
size in interface Map
Returns:
the number of elements in this Map

toString

public java.lang.String toString()
Answers the string representation of this Map.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this Map

values

public Collection values()
Answers a collection of the values contained in this map. The collection is backed by this map so changes to one are reflected by the other. The collection supports remove, removeAll, retainAll and clear operations, and it does not support add or addAll operations. This method answers a collection which is the subclass of AbstractCollection. The iterator method of this subclass answers a "wrapper object" over the iterator of map's entrySet(). The size method wraps the map's size method and the contains method wraps the map's containsValue method. The collection is created when this method is called at first time and returned in response to all subsequent calls. This method may return different Collection when multiple calls to this method, since it has no synchronization performed.

Specified by:
values in interface Map
Returns:
a collection of the values contained in this map

clone

protected java.lang.Object clone()
                          throws CloneNotSupportedException
Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.

Returns:
Object a shallow copy of this object.
Throws:
CloneNotSupportedException - if the receiver's class does not implement the interface 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.