Colt 1.0.1

edu.oswego.cs.dl.util.concurrent
Class SyncList

java.lang.Object
  |
  +--edu.oswego.cs.dl.util.concurrent.SyncCollection
        |
        +--edu.oswego.cs.dl.util.concurrent.SyncList
All Implemented Interfaces:
Collection, List

public class SyncList
extends SyncCollection
implements List

SyncLists wrap Sync-based control around java.util.Lists. They support the following additional reader operations over SyncCollection: hashCode, equals, get, indexOf, lastIndexOf, subList. They support additional writer operations remove(int), set(int), add(int), addAll(int). The corresponding listIterators and are similarly extended.

[ Introduction to this package. ]

See Also:
SyncCollection

Inner Class Summary
 class SyncList.SyncCollectionListIterator
           
 
Inner classes inherited from class edu.oswego.cs.dl.util.concurrent.SyncCollection
SyncCollection.SyncCollectionIterator
 
Constructor Summary
SyncList(List list, ReadWriteLock rwl)
          Create a new SyncList protecting the given list, and using the given ReadWriteLock to control reader and writer methods.
SyncList(List list, Sync sync)
          Create a new SyncList protecting the given collection, and using the given sync to control both reader and writer methods.
SyncList(List list, Sync readLock, Sync writeLock)
          Create a new SyncList protecting the given list, and using the given pair of locks to control reader and writer methods.
 
Method Summary
 void add(int index, Object o)
           
 boolean addAll(int index, Collection coll)
           
 boolean equals(Object o)
           
 Object get(int index)
           
 int hashCode()
           
 int indexOf(Object o)
           
 int lastIndexOf(Object o)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 Object remove(int index)
           
 Object set(int index, Object o)
           
 List subList(int fromIndex, int toIndex)
           
 ListIterator unprotectedListIterator()
           
 ListIterator unprotectedListIterator(int index)
           
 
Methods inherited from class edu.oswego.cs.dl.util.concurrent.SyncCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, readerSync, remove, removeAll, retainAll, size, syncFailures, toArray, toArray, unprotectedIterator, writerSync
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

SyncList

public SyncList(List list,
                ReadWriteLock rwl)
Create a new SyncList protecting the given list, and using the given ReadWriteLock to control reader and writer methods.

SyncList

public SyncList(List list,
                Sync sync)
Create a new SyncList protecting the given collection, and using the given sync to control both reader and writer methods. Common, reasonable choices for the sync argument include Mutex, ReentrantLock, and Semaphores initialized to 1.

SyncList

public SyncList(List list,
                Sync readLock,
                Sync writeLock)
Create a new SyncList protecting the given list, and using the given pair of locks to control reader and writer methods.
Method Detail

add

public void add(int index,
                Object o)
Specified by:
add in interface List

addAll

public boolean addAll(int index,
                      Collection coll)
Specified by:
addAll in interface List

equals

public boolean equals(Object o)
Specified by:
equals in interface List
Overrides:
equals in class Object

get

public Object get(int index)
Specified by:
get in interface List

hashCode

public int hashCode()
Specified by:
hashCode in interface List
Overrides:
hashCode in class Object

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List

listIterator

public ListIterator listIterator(int index)
Specified by:
listIterator in interface List

remove

public Object remove(int index)
Specified by:
remove in interface List

set

public Object set(int index,
                  Object o)
Specified by:
set in interface List

subList

public List subList(int fromIndex,
                    int toIndex)
Specified by:
subList in interface List

unprotectedListIterator

public ListIterator unprotectedListIterator()

unprotectedListIterator

public ListIterator unprotectedListIterator(int index)

Colt 1.0.1

Submit a bug or feature. Check the Colt home page for the latest news.