Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

freemarker.template.utility
Class Collections12.EmptyMap  view Collections12.EmptyMap download Collections12.EmptyMap.java

java.lang.Object
  extended byjava.util.AbstractMap
      extended byfreemarker.template.utility.Collections12.EmptyMap
All Implemented Interfaces:
java.util.Map, java.io.Serializable
Enclosing class:
Collections12

private static final class Collections12.EmptyMap
extends java.util.AbstractMap
implements java.io.Serializable


Nested Class Summary
 
Nested classes inherited from class java.util.AbstractMap
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
 
Fields inherited from class java.util.AbstractMap
 
Constructor Summary
private Collections12.EmptyMap()
           
 
Method Summary
 boolean containsKey(java.lang.Object key)
          Returns true if this contains a mapping for the given key.
 boolean containsValue(java.lang.Object value)
          Returns true if this contains at least one mapping with the given value.
 java.util.Set entrySet()
          Returns a set view of the mappings in this Map.
 boolean equals(java.lang.Object o)
          Compares the specified object with this map for equality.
 java.lang.Object get(java.lang.Object key)
          Returns the value mapped by the given key.
 int hashCode()
          Returns the hash code for this map.
 boolean isEmpty()
          Returns true if the map contains no mappings.
 java.util.Set keySet()
          Returns a set view of this map's keys.
 int size()
          Returns the number of key-value mappings in the map.
 java.util.Collection values()
          Returns a collection or bag view of this map's values.
 
Methods inherited from class java.util.AbstractMap
clear, clone, put, putAll, remove, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Collections12.EmptyMap

private Collections12.EmptyMap()
Method Detail

size

public int size()
Description copied from class: java.util.AbstractMap
Returns the number of key-value mappings in the map. If there are more than Integer.MAX_VALUE mappings, return Integer.MAX_VALUE. This is implemented as entrySet().size().

Specified by:
size in interface java.util.Map

isEmpty

public boolean isEmpty()
Description copied from class: java.util.AbstractMap
Returns true if the map contains no mappings. This is implemented by size() == 0.

Specified by:
isEmpty in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)
Description copied from class: java.util.AbstractMap
Returns true if this contains a mapping for the given key. This implementation does a linear search, O(n), over the entrySet(), returning true if a match is found, false if the iteration ends. Many subclasses can implement this more efficiently.

Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object value)
Description copied from class: java.util.AbstractMap
Returns true if this contains at least one mapping with the given value. This implementation does a linear search, O(n), over the entrySet(), returning true if a match is found, false if the iteration ends. A match is defined as a value, v, where (value == null ? v == null : value.equals(v)). Subclasses are unlikely to implement this more efficiently.

Specified by:
containsValue in interface java.util.Map

get

public java.lang.Object get(java.lang.Object key)
Description copied from class: java.util.AbstractMap
Returns the value mapped by the given key. Returns null if there is no mapping. However, in Maps that accept null values, you must rely on containsKey to determine if a mapping exists. This iteration takes linear time, searching entrySet().iterator() of the key. Many implementations override this method.

Specified by:
get in interface java.util.Map

keySet

public java.util.Set keySet()
Description copied from class: java.util.AbstractMap
Returns a set view of this map's keys. The set is backed by the map, so changes in one show up in the other. Modifications while an iteration is in progress produce undefined behavior. The set supports removal if entrySet() does, but does not support element addition.

This implementation creates an AbstractSet, where the iterator wraps the entrySet iterator, size defers to the Map's size, and contains defers to the Map's containsKey. The set is created on first use, and returned on subsequent uses, although since no synchronization occurs, there is a slight possibility of creating two sets.

Specified by:
keySet in interface java.util.Map

values

public java.util.Collection values()
Description copied from class: java.util.AbstractMap
Returns a collection or bag view of this map's values. The collection is backed by the map, so changes in one show up in the other. Modifications while an iteration is in progress produce undefined behavior. The collection supports removal if entrySet() does, but does not support element addition.

This implementation creates an AbstractCollection, where the iterator wraps the entrySet iterator, size defers to the Map's size, and contains defers to the Map's containsValue. The collection is created on first use, and returned on subsequent uses, although since no synchronization occurs, there is a slight possibility of creating two collections.

Specified by:
values in interface java.util.Map

entrySet

public java.util.Set entrySet()
Description copied from class: java.util.AbstractMap
Returns a set view of the mappings in this Map. Each element in the set must be an implementation of Map.Entry. The set is backed by the map, so that changes in one show up in the other. Modifications made while an iterator is in progress cause undefined behavior. If the set supports removal, these methods must be valid: Iterator.remove, Set.remove, removeAll, retainAll, and clear. Element addition is not supported via this set.

Specified by:
entrySet in interface java.util.Map

equals

public boolean equals(java.lang.Object o)
Description copied from class: java.util.AbstractMap
Compares the specified object with this map for equality. Returns true if the other object is a Map with the same mappings, that is,
o instanceof Map && entrySet().equals(((Map) o).entrySet();

Specified by:
equals in interface java.util.Map

hashCode

public int hashCode()
Description copied from class: java.util.AbstractMap
Returns the hash code for this map. As defined in Map, this is the sum of all hashcodes for each Map.Entry object in entrySet, or basically entrySet().hashCode().

Specified by:
hashCode in interface java.util.Map