Build 1.0_r1(from source)

java.util.concurrent
Class CopyOnWriteArrayList.SubList

java.lang.Object
  extended by java.util.concurrent.CopyOnWriteArrayList.SubList
All Implemented Interfaces:
Iterable, Collection, List
Enclosing class:
CopyOnWriteArrayList<E>

static class CopyOnWriteArrayList.SubList
extends Object
implements List

Represents a list returned by sublist().


Constructor Summary
CopyOnWriteArrayList.SubList(CopyOnWriteArrayList list, int fromIdx, int toIdx)
          Sublist constructor.
 
Method Summary
 void add(int index, Object object)
          Inserts the specified object into this Vector at the specified location.
 boolean add(Object o)
          Adds the specified object at the end of this List.
 boolean addAll(Collection c)
          Adds the objects in the specified Collection to the end of this List.
 boolean addAll(int index, Collection collection)
          Inserts the objects in the specified Collection at the specified location in this List.
 void clear()
          Removes all elements from this List, leaving it empty.
 boolean contains(Object o)
          Searches this List for the specified object.
 boolean containsAll(Collection c)
          Searches this List for all objects in the specified Collection.
 Object get(int index)
          Returns the element at the specified location in this List.
 int indexOf(Object o)
          Searches this List for the specified object and returns the index of the first occurrence.
 boolean isEmpty()
          Returns if this List has no elements, a size of zero.
 Iterator iterator()
          Returns an Iterator on the elements of this List.
 int lastIndexOf(Object o)
          Searches this List for the specified object and returns the index of the last occurrence.
 ListIterator listIterator()
          Returns a ListIterator on the elements of this List.
 ListIterator listIterator(int startIdx)
          Returns a ListIterator on the elements of this List.
 Object remove(int index)
          Removes the object at the specified location from this List.
 boolean remove(Object o)
          Removes the first occurrence of the specified object from this List.
 boolean removeAll(Collection c)
          Removes all occurrences in this List of each object in the specified Collection.
 boolean retainAll(Collection c)
          Removes all objects from this List that are not contained in the specified Collection.
 Object set(int index, Object obj)
          Replaces the element at the specified location in this List with the specified object.
 int size()
          Returns the number of elements in this List.
 List subList(int fromIndex, int toIndex)
          Returns a List of the specified portion of this List from the start index to one less than the end index.
 Object[] toArray()
          Returns an array containing all elements contained in this List.
 Object[] toArray(Object[] a)
          Returns an array containing all elements contained in this List.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Constructor Detail

CopyOnWriteArrayList.SubList

public CopyOnWriteArrayList.SubList(CopyOnWriteArrayList list,
                                    int fromIdx,
                                    int toIdx)
Sublist constructor.

Parameters:
list - backing list.
fromIdx - startingIndex, inclusive
toIdx - endIndex, exclusive
Method Detail

listIterator

public ListIterator listIterator(int startIdx)
Description copied from interface: List
Returns a ListIterator on the elements of this List. The elements are iterated in the same order that they occur in the List. The iteration starts at the specified location.

Specified by:
listIterator in interface List
Parameters:
startIdx - the index at which to start the iteration
Returns:
a ListIterator on the elements of this List
See Also:
List.listIterator(int)

set

public Object set(int index,
                  Object obj)
Description copied from interface: List
Replaces the element at the specified location in this List with the specified object.

Specified by:
set in interface List
Parameters:
index - the index at which to put the specified object
obj - the object to add
Returns:
the previous element at the index
See Also:
List.set(int, java.lang.Object)

get

public Object get(int index)
Description copied from interface: List
Returns the element at the specified location in this List.

Specified by:
get in interface List
Parameters:
index - the index of the element to return
Returns:
the element at the specified location
See Also:
List.get(int)

size

public int size()
Description copied from interface: List
Returns the number of elements in this List.

Specified by:
size in interface Collection
Specified by:
size in interface List
Returns:
the number of elements in this List
See Also:
Collection.size()

remove

public Object remove(int index)
Description copied from interface: List
Removes the object at the specified location from this List.

Specified by:
remove in interface List
Parameters:
index - the index of the object to remove
Returns:
the removed object
See Also:
List.remove(int)

add

public void add(int index,
                Object object)
Description copied from interface: List
Inserts the specified object into this Vector at the specified location. The object is inserted before any previous element at the specified location. If the location is equal to the size of this List, the object is added at the end.

Specified by:
add in interface List
Parameters:
index - the index at which to insert
object - the object to add
See Also:
List.add(int, java.lang.Object)

add

public boolean add(Object o)
Description copied from interface: List
Adds the specified object at the end of this List.

Specified by:
add in interface Collection
Specified by:
add in interface List
Parameters:
o - the object to add
Returns:
true

addAll

public boolean addAll(Collection c)
Description copied from interface: List
Adds the objects in the specified Collection to the end of this List. The objects are added in the order they are returned from the Collection iterator.

Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Parameters:
c - the Collection of objects
Returns:
true if this List is modified, false otherwise

clear

public void clear()
Description copied from interface: List
Removes all elements from this List, leaving it empty.

Specified by:
clear in interface Collection
Specified by:
clear in interface List
See Also:
List.isEmpty(), List.size()

contains

public boolean contains(Object o)
Description copied from interface: List
Searches this List for the specified object.

Specified by:
contains in interface Collection
Specified by:
contains in interface List
Parameters:
o - the object to search for
Returns:
true if object is an element of this List, false otherwise

containsAll

public boolean containsAll(Collection c)
Description copied from interface: List
Searches this List for all objects in the specified Collection.

Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List
Parameters:
c - the Collection of objects
Returns:
true if all objects in the specified Collection are elements of this List, false otherwise

indexOf

public int indexOf(Object o)
Description copied from interface: List
Searches this List for the specified object and returns the index of the first occurrence.

Specified by:
indexOf in interface List
Parameters:
o - the object to search for
Returns:
the index of the first occurrence of the object

isEmpty

public boolean isEmpty()
Description copied from interface: List
Returns if this List has no elements, a size of zero.

Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface List
Returns:
true if this List has no elements, false otherwise
See Also:
List.size()

iterator

public Iterator iterator()
Description copied from interface: List
Returns an Iterator on the elements of this List. The elements are iterated in the same order that they occur in the List.

Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List
Returns:
an Iterator on the elements of this List
See Also:
Iterator

lastIndexOf

public int lastIndexOf(Object o)
Description copied from interface: List
Searches this List for the specified object and returns the index of the last occurrence.

Specified by:
lastIndexOf in interface List
Parameters:
o - the object to search for
Returns:
the index of the last occurrence of the object

listIterator

public ListIterator listIterator()
Description copied from interface: List
Returns a ListIterator on the elements of this List. The elements are iterated in the same order that they occur in the List.

Specified by:
listIterator in interface List
Returns:
a ListIterator on the elements of this List
See Also:
ListIterator

remove

public boolean remove(Object o)
Description copied from interface: List
Removes the first occurrence of the specified object from this List.

Specified by:
remove in interface Collection
Specified by:
remove in interface List
Parameters:
o - the object to remove
Returns:
true if this List is modified, false otherwise

removeAll

public boolean removeAll(Collection c)
Description copied from interface: List
Removes all occurrences in this List of each object in the specified Collection.

Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List
Parameters:
c - the Collection of objects to remove
Returns:
true if this List is modified, false otherwise

retainAll

public boolean retainAll(Collection c)
Description copied from interface: List
Removes all objects from this List that are not contained in the specified Collection.

Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List
Parameters:
c - the Collection of objects to retain
Returns:
true if this List is modified, false otherwise

subList

public List subList(int fromIndex,
                    int toIndex)
Description copied from interface: List
Returns a List of the specified portion of this List from the start index to one less than the end index. The returned List is backed by this list so changes to one are reflected by the other.

Specified by:
subList in interface List
Parameters:
fromIndex - the index at which to start the sublist
toIndex - the index one past the end of the sublist
Returns:
a List of a portion of this List

toArray

public Object[] toArray()
Description copied from interface: List
Returns an array containing all elements contained in this List.

Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Returns:
an array of the elements from this List

toArray

public Object[] toArray(Object[] a)
Description copied from interface: List
Returns an array containing all elements contained in this List. If the specified array is large enough to hold the elements, the specified array is used, otherwise an array of the same type is created. If the specified array is used and is larger than this List, the array element following the collection elements is set to null.

Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Parameters:
a - the array
Returns:
an array of the elements from this List

addAll

public boolean addAll(int index,
                      Collection collection)
Description copied from interface: List
Inserts the objects in the specified Collection at the specified location in this List. The objects are added in the order they are returned from the Collection iterator.

Specified by:
addAll in interface List
Parameters:
index - the index at which to insert
collection - the Collection of objects
Returns:
true if this List is modified, false otherwise
See Also:
List.addAll(int, java.util.Collection)

Build 1.0_r1(from source)

Please submit a feedback, bug or feature