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

Quick Search    Search Deep

java.util
Class Collections.CopiesList  view Collections.CopiesList download Collections.CopiesList.java

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

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

The implementation of Collections.nCopies(int, Object) 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  java.lang.Object element
          The repeated list element.
private  int n
          The count of elements in this list.
private static long serialVersionUID
          Compatible with JDK 1.4.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
(package private) Collections.CopiesList(int n, java.lang.Object o)
          Constructs the list.
 
Method Summary
 boolean contains(java.lang.Object o)
          This list only contains one element.
 java.lang.Object get(int index)
          The same element is returned.
 int indexOf(java.lang.Object o)
          The index is either 0 or -1.
 int lastIndexOf(java.lang.Object o)
          The index is either n-1 or -1.
 int size()
          The size is fixed.
 List subList(int from, int to)
          A subList is just another CopiesList.
 java.lang.Object[] toArray()
          The array is easy.
 java.lang.String toString()
          The string is easy to generate.
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, iterator, listIterator, listIterator, remove, removeRange, set
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, equals, hashCode, isEmpty, remove, removeAll, removeAllInternal, retainAll, retainAllInternal, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Compatible with JDK 1.4.

See Also:
Constant Field Values

n

private final int n
The count of elements in this list.


element

private final java.lang.Object element
The repeated list element.

Constructor Detail

Collections.CopiesList

Collections.CopiesList(int n,
                       java.lang.Object o)
Constructs the list.

Method Detail

size

public int size()
The size is fixed.

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

get

public java.lang.Object get(int index)
The same element is returned.

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

contains

public boolean contains(java.lang.Object o)
This list only contains one element.

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

indexOf

public int indexOf(java.lang.Object o)
The index is either 0 or -1.

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

lastIndexOf

public int lastIndexOf(java.lang.Object o)
The index is either n-1 or -1.

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

subList

public List subList(int from,
                    int to)
A subList is just another CopiesList.

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

toArray

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

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

toString

public java.lang.String toString()
The string is easy to generate.

Overrides:
toString in class AbstractCollection