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

Quick Search    Search Deep

java.util
Class Collections.SingletonMap  view Collections.SingletonMap download Collections.SingletonMap.java

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.Collections.SingletonMap
All Implemented Interfaces:
Map, java.io.Serializable
Enclosing class:
Collections

private static final class Collections.SingletonMap
extends AbstractMap
implements java.io.Serializable

The implementation of Collections.singletonMap(Object, Object) 55 . This class name is required for compatibility with Sun's JDK serializability.


Nested Class Summary
 
Nested classes inherited from class java.util.AbstractMap
AbstractMap.BasicMapEntry
 
Nested classes inherited from class java.util.Map
Map.Entry
 
Field Summary
private  Set entries
          Cache the entry set.
private  java.lang.Object k
          The single key.
private static long serialVersionUID
          Compatible with JDK 1.4.
private  java.lang.Object v
          The corresponding value.
 
Fields inherited from class java.util.AbstractMap
ENTRIES, keys, KEYS, values, VALUES
 
Constructor Summary
(package private) Collections.SingletonMap(java.lang.Object key, java.lang.Object value)
          Construct a singleton.
 
Method Summary
 boolean containsKey(java.lang.Object key)
          Single entry.
 boolean containsValue(java.lang.Object value)
          Single entry.
 Set entrySet()
          There is a single immutable entry.
 java.lang.Object get(java.lang.Object key)
          Single entry.
 int hashCode()
          Calculate the hashcode directly.
 Set keySet()
          Return the keyset.
 int size()
          The size: always 1!
 java.lang.String toString()
          Obvious string.
 Collection values()
          Return the values.
 
Methods inherited from class java.util.AbstractMap
clear, clone, equals, equals, hashCode, isEmpty, put, putAll, remove
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Compatible with JDK 1.4.

See Also:
Constant Field Values

k

private final java.lang.Object k
The single key.


v

private final java.lang.Object v
The corresponding value.


entries

private transient Set entries
Cache the entry set.

Constructor Detail

Collections.SingletonMap

Collections.SingletonMap(java.lang.Object key,
                         java.lang.Object value)
Construct a singleton.

Method Detail

entrySet

public Set entrySet()
There is a single immutable entry.

Specified by:
entrySet in interface Map
Specified by:
entrySet in class AbstractMap

containsKey

public boolean containsKey(java.lang.Object key)
Single entry.

Specified by:
containsKey in interface Map
Overrides:
containsKey in class AbstractMap

containsValue

public boolean containsValue(java.lang.Object value)
Single entry.

Specified by:
containsValue in interface Map
Overrides:
containsValue in class AbstractMap

get

public java.lang.Object get(java.lang.Object key)
Single entry.

Specified by:
get in interface Map
Overrides:
get in class AbstractMap

hashCode

public int hashCode()
Calculate the hashcode directly.

Specified by:
hashCode in interface Map
Overrides:
hashCode in class AbstractMap

keySet

public Set keySet()
Return the keyset.

Specified by:
keySet in interface Map
Overrides:
keySet in class AbstractMap

size

public int size()
The size: always 1!

Specified by:
size in interface Map
Overrides:
size in class AbstractMap

values

public Collection values()
Return the values. Technically, a singleton, while more specific than a general Collection, will work. Besides, that's what the JDK uses!

Specified by:
values in interface Map
Overrides:
values in class AbstractMap

toString

public java.lang.String toString()
Obvious string.

Overrides:
toString in class AbstractMap