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

Quick Search    Search Deep

java.util
Class Collections.EmptyList  view Collections.EmptyList download Collections.EmptyList.java

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Collections.EmptyList
All Implemented Interfaces:
Collection, java.lang.Iterable, List, RandomAccess, java.io.Serializable
Enclosing class:
Collections

private static final class Collections.EmptyList
extends AbstractList
implements java.io.Serializable, RandomAccess

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


Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
Field Summary
private static long serialVersionUID
          Compatible with JDK 1.4.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
(package private) Collections.EmptyList()
          A private constructor adds overhead.
 
Method Summary
 boolean contains(java.lang.Object o)
          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 list is empty.
 java.lang.Object get(int index)
          No matter the index, it is out of bounds.
 int hashCode()
          The hashcode is always 1.
 int indexOf(java.lang.Object o)
          Returns -1.
 int lastIndexOf(java.lang.Object o)
          Returns -1.
 boolean remove(java.lang.Object o)
          Always succeeds with false result.
 boolean removeAll(Collection c)
          Always succeeds with false result.
 boolean retainAll(Collection c)
          Always succeeds with false result.
 int size()
          The size is 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.AbstractList
add, add, addAll, clear, iterator, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, 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.List
addAll, isEmpty
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Compatible with JDK 1.4.

See Also:
Constant Field Values
Constructor Detail

Collections.EmptyList

Collections.EmptyList()
A private constructor adds overhead.

Method Detail

size

public int size()
The size is always 0.

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

get

public java.lang.Object get(int index)
No matter the index, it is out of bounds. This method never returns, throwing an exception instead.

Specified by:
get in interface List
Specified by:
get in class AbstractList

contains

public boolean contains(java.lang.Object o)
Never contains anything.

Specified by:
contains in interface List
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 List
Overrides:
containsAll in class AbstractCollection

equals

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

Specified by:
equals in interface List
Overrides:
equals in class AbstractList

hashCode

public int hashCode()
The hashcode is always 1.

Specified by:
hashCode in interface List
Overrides:
hashCode in class AbstractList

indexOf

public int indexOf(java.lang.Object o)
Returns -1.

Specified by:
indexOf in interface List
Overrides:
indexOf in class AbstractList

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Returns -1.

Specified by:
lastIndexOf in interface List
Overrides:
lastIndexOf in class AbstractList

remove

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

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

removeAll

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

Specified by:
removeAll in interface List
Overrides:
removeAll in class AbstractCollection

retainAll

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

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

toArray

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

Specified by:
toArray in interface List
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 List
Overrides:
toArray in class AbstractCollection

toString

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

Overrides:
toString in class AbstractCollection