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

Quick Search    Search Deep

java.util
Class Collections.EmptySet  view Collections.EmptySet download Collections.EmptySet.java

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended byjava.util.Collections.EmptySet
All Implemented Interfaces:
Collection, java.lang.Iterable, java.io.Serializable, Set
Enclosing class:
Collections

private static final class Collections.EmptySet
extends AbstractSet
implements java.io.Serializable

The implementation of Collections.EMPTY_SET 55 . This class name is required for compatibility with Sun's JDK serializability.


Field Summary
private static long serialVersionUID
          Compatible with JDK 1.4.
 
Constructor Summary
(package private) Collections.EmptySet()
          A private constructor adds overhead.
 
Method Summary
 boolean contains(java.lang.Object o)
          The empty set never contains anything.
 boolean containsAll(Collection c)
          This is true only if the given collection is also empty.
 boolean equals(java.lang.Object o)
          Equal only if the other set is empty.
 int hashCode()
          The hashcode is always 0.
 Iterator iterator()
          Returns an iterator that does not iterate.
 boolean remove(java.lang.Object o)
          Always succeeds with a false result.
 boolean removeAll(Collection c)
          Always succeeds with a false result.
 boolean retainAll(Collection c)
          Always succeeds with a false result.
 int size()
          The size: always 0!
 java.lang.Object[] toArray()
          The array is always empty.
 java.lang.Object[] toArray(java.lang.Object[] a)
          We don't even need to use reflection!
 java.lang.String toString()
          The string never changes.
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, equals, hashCode, isEmpty, removeAllInternal, retainAllInternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
add, addAll, clear, isEmpty
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Compatible with JDK 1.4.

See Also:
Constant Field Values
Constructor Detail

Collections.EmptySet

Collections.EmptySet()
A private constructor adds overhead.

Method Detail

size

public int size()
The size: always 0!

Specified by:
size in interface Set
Specified by:
size in class AbstractCollection

iterator

public Iterator iterator()
Returns an iterator that does not iterate.

Specified by:
iterator in interface Set
Specified by:
iterator in class AbstractCollection

contains

public boolean contains(java.lang.Object o)
The empty set never contains anything.

Specified by:
contains in interface Set
Overrides:
contains in class AbstractCollection

containsAll

public boolean containsAll(Collection c)
This is true only if the given collection is also empty.

Specified by:
containsAll in interface Set
Overrides:
containsAll in class AbstractCollection

equals

public boolean equals(java.lang.Object o)
Equal only if the other set is empty.

Specified by:
equals in interface Set
Overrides:
equals in class AbstractSet

hashCode

public int hashCode()
The hashcode is always 0.

Specified by:
hashCode in interface Set
Overrides:
hashCode in class AbstractSet

remove

public boolean remove(java.lang.Object o)
Always succeeds with a false result.

Specified by:
remove in interface Set
Overrides:
remove in class AbstractCollection

removeAll

public boolean removeAll(Collection c)
Always succeeds with a false result.

Specified by:
removeAll in interface Set
Overrides:
removeAll in class AbstractSet

retainAll

public boolean retainAll(Collection c)
Always succeeds with a false result.

Specified by:
retainAll in interface Set
Overrides:
retainAll in class AbstractCollection

toArray

public java.lang.Object[] toArray()
The array is always empty.

Specified by:
toArray in interface Set
Overrides:
toArray in class AbstractCollection

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
We don't even need to use reflection!

Specified by:
toArray in interface Set
Overrides:
toArray in class AbstractCollection

toString

public java.lang.String toString()
The string never changes.

Overrides:
toString in class AbstractCollection