Build 1.0_r1(from source)

java.util
Class Collections.SynchronizedList<E>

java.lang.Object
  extended by java.util.Collections.SynchronizedCollection<E>
      extended by java.util.Collections.SynchronizedList<E>
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, List<E>
Direct Known Subclasses:
Collections.SynchronizedRandomAccessList
Enclosing class:
Collections

static class Collections.SynchronizedList<E>
extends Collections.SynchronizedCollection<E>
implements List<E>


Field Summary
(package private)  List<E> list
           
 
Fields inherited from class java.util.Collections.SynchronizedCollection
c, mutex
 
Constructor Summary
Collections.SynchronizedList(List<E> l)
           
Collections.SynchronizedList(List<E> l, Object mutex)
           
 
Method Summary
 void add(int location, E object)
          Inserts the specified object into this Vector at the specified location.
 boolean addAll(int location, Collection<? extends E> collection)
          Inserts the objects in the specified Collection at the specified location in this List.
 boolean equals(Object object)
          Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 E get(int location)
          Returns the element at the specified location in this List.
 int hashCode()
          Returns an integer hash code for the receiver.
 int indexOf(Object object)
          Searches this List for the specified object and returns the index of the first occurrence.
 int lastIndexOf(Object object)
          Searches this List for the specified object and returns the index of the last occurrence.
 ListIterator<E> listIterator()
          Returns a ListIterator on the elements of this List.
 ListIterator<E> listIterator(int location)
          Returns a ListIterator on the elements of this List.
 E remove(int location)
          Removes the object at the specified location from this List.
 E set(int location, E object)
          Replaces the element at the specified location in this List with the specified object.
 List<E> subList(int start, int end)
          Returns a List of the specified portion of this List from the start index to one less than the end index.
 
Methods inherited from class java.util.Collections.SynchronizedCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Field Detail

list

final List<E> list
Constructor Detail

Collections.SynchronizedList

Collections.SynchronizedList(List<E> l)

Collections.SynchronizedList

Collections.SynchronizedList(List<E> l,
                             Object mutex)
Method Detail

add

public void add(int location,
                E 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<E>
Parameters:
location - the index at which to insert
object - the object to add

addAll

public boolean addAll(int location,
                      Collection<? extends E> 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<E>
Parameters:
location - the index at which to insert
collection - the Collection of objects
Returns:
true if this List is modified, false otherwise

equals

public boolean equals(Object object)
Description copied from class: Object
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison. The implementation in Object returns true only if the argument is the exact same object as the receiver (==).

Specified by:
equals in interface Collection<E>
Specified by:
equals in interface List<E>
Overrides:
equals in class Object
Parameters:
object - Object the object to compare with this object.
Returns:
boolean true if the object is the same as this object false if it is different from this object.
See Also:
Object.hashCode()

get

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

Specified by:
get in interface List<E>
Parameters:
location - the index of the element to return
Returns:
the element at the specified location

hashCode

public int hashCode()
Description copied from class: Object
Returns an integer hash code for the receiver. Any two objects which answer true when passed to .equals must answer the same value for this method.

Specified by:
hashCode in interface Collection<E>
Specified by:
hashCode in interface List<E>
Overrides:
hashCode in class Object
Returns:
int the receiver's hash.
See Also:
Object.equals(java.lang.Object)

indexOf

public int indexOf(Object object)
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<E>
Parameters:
object - the object to search for
Returns:
the index of the first occurrence of the object

lastIndexOf

public int lastIndexOf(Object object)
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<E>
Parameters:
object - the object to search for
Returns:
the index of the last occurrence of the object

listIterator

public ListIterator<E> 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<E>
Returns:
a ListIterator on the elements of this List
See Also:
ListIterator

listIterator

public ListIterator<E> listIterator(int location)
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<E>
Parameters:
location - the index at which to start the iteration
Returns:
a ListIterator on the elements of this List
See Also:
ListIterator

remove

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

Specified by:
remove in interface List<E>
Parameters:
location - the index of the object to remove
Returns:
the removed object

set

public E set(int location,
             E object)
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<E>
Parameters:
location - the index at which to put the specified object
object - the object to add
Returns:
the previous element at the index

subList

public List<E> subList(int start,
                       int end)
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<E>
Parameters:
start - the index at which to start the sublist
end - the index one past the end of the sublist
Returns:
a List of a portion of this List

Build 1.0_r1(from source)

Please submit a feedback, bug or feature