## 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:
  java.lang.Iterable, java.util.Collection, java.util.List

    public class SyncList

extends SyncCollection
implements java.util.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`

Nested Class Summary
`class` `SyncList.SyncCollectionListIterator`

Nested classes/interfaces inherited from class EDU.oswego.cs.dl.util.concurrent.SyncCollection
`SyncCollection.SyncCollectionIterator`

Field Summary

Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SyncCollection
`c_, rd_, syncFailures_, wr_`

Constructor Summary
`SyncList(java.util.List list, ReadWriteLock rwl)` Create a new SyncList protecting the given list, and using the given ReadWriteLock to control reader and writer methods.
`SyncList(java.util.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(java.util.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, java.lang.Object o)`
`boolean` `addAll(int index, java.util.Collection coll)`
`protected java.util.List` `baseList()`
`boolean` `equals(java.lang.Object o)`
`java.lang.Object` `get(int index)`
`int` `hashCode()`
`int` `indexOf(java.lang.Object o)`
`int` `lastIndexOf(java.lang.Object o)`
`java.util.ListIterator` `listIterator()`
`java.util.ListIterator` `listIterator(int index)`
`java.lang.Object` `remove(int index)`
`java.lang.Object` `set(int index, java.lang.Object o)`
`java.util.List` `subList(int fromIndex, int toIndex)`
`java.util.ListIterator` `unprotectedListIterator()`
`java.util.ListIterator` `unprotectedListIterator(int index)`

Methods inherited from class EDU.oswego.cs.dl.util.concurrent.SyncCollection
`add, addAll, afterRead, beforeRead, clear, contains, containsAll, isEmpty, iterator, readerSync, remove, removeAll, retainAll, size, syncFailures, toArray, toArray, unprotectedIterator, writerSync`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.util.List
`add, addAll, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray`

Constructor Detail

### SyncList

    public SyncList(java.util.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(java.util.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(java.util.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

### baseList

    protected java.util.List baseList()

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `java.util.Collection`
  Specified by:
    `hashCode` in interface `java.util.List`
  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.Object o)

  Specified by:
    `equals` in interface `java.util.Collection`
  Specified by:
    `equals` in interface `java.util.List`
  Overrides:
    `equals` in class `java.lang.Object`

### get

    public java.lang.Object get(int index)

  Specified by:
    `get` in interface `java.util.List`

### indexOf

    public int indexOf(java.lang.Object o)

  Specified by:
    `indexOf` in interface `java.util.List`

### lastIndexOf

    public int lastIndexOf(java.lang.Object o)

  Specified by:
    `lastIndexOf` in interface `java.util.List`

### subList

    public java.util.List subList(int fromIndex,
                                  int toIndex)

  Specified by:
    `subList` in interface `java.util.List`

### set

    public java.lang.Object set(int index,
                                java.lang.Object o)

  Specified by:
    `set` in interface `java.util.List`

### remove

    public java.lang.Object remove(int index)

  Specified by:
    `remove` in interface `java.util.List`

### add

    public void add(int index,
                    java.lang.Object o)

  Specified by:
    `add` in interface `java.util.List`

### addAll

    public boolean addAll(int index,
                          java.util.Collection coll)

### unprotectedListIterator

    public java.util.ListIterator unprotectedListIterator()

### listIterator

    public java.util.ListIterator listIterator()

  Specified by:
    `listIterator` in interface `java.util.List`

### unprotectedListIterator

    public java.util.ListIterator unprotectedListIterator(int index)

### listIterator

    public java.util.ListIterator listIterator(int index)

  Specified by:
    `listIterator` in interface `java.util.List`