EDU.oswego.cs.dl.util.concurrent

Class SyncList

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:

Nested Class Summary
classSyncList.SyncCollectionListIterator
Constructor Summary
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, 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 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
voidadd(int index, Object o)
booleanaddAll(int index, Collection coll)
protected ListbaseList()
booleanequals(Object o)
Objectget(int index)
inthashCode()
intindexOf(Object o)
intlastIndexOf(Object o)
ListIteratorlistIterator()
ListIteratorlistIterator(int index)
Objectremove(int index)
Objectset(int index, Object o)
ListsubList(int fromIndex, int toIndex)
ListIteratorunprotectedListIterator()
ListIteratorunprotectedListIterator(int index)

Constructor Detail

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, 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 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)

addAll

public boolean addAll(int index, Collection coll)

baseList

protected List baseList()

equals

public boolean equals(Object o)

get

public Object get(int index)

hashCode

public int hashCode()

indexOf

public int indexOf(Object o)

lastIndexOf

public int lastIndexOf(Object o)

listIterator

public ListIterator listIterator()

listIterator

public ListIterator listIterator(int index)

remove

public Object remove(int index)

set

public Object set(int index, Object o)

subList

public List subList(int fromIndex, int toIndex)

unprotectedListIterator

public ListIterator unprotectedListIterator()

unprotectedListIterator

public ListIterator unprotectedListIterator(int index)