com.springsource.util.common
Class SynchronizedListIterator<T>

java.lang.Object
  extended by com.springsource.util.common.SynchronizedObject
      extended by com.springsource.util.common.SynchronizedIterator<T>
          extended by com.springsource.util.common.SynchronizedListIterator<T>
Type Parameters:
T - the type of the list elements
All Implemented Interfaces:
java.util.Iterator<T>, java.util.ListIterator<T>

public class SynchronizedListIterator<T>
extends SynchronizedIterator<T>
implements java.util.ListIterator<T>

SynchronizedListIterator wraps a given ListIterator and protects access to the iterator by synchronizing on the monitor of the containing SynchronizedList.

Concurrent Semantics
This class is thread safe, but ConcurrentModificationException may still be thrown.

Since:
jersey
Author:
Glyn Normington

Field Summary
private  java.util.ListIterator<T> listIterator
           
private  java.lang.Object monitor
           
 
Constructor Summary
SynchronizedListIterator(java.util.ListIterator<T> listIterator, java.lang.Object monitor)
           
 
Method Summary
 void add(T e)
          
 boolean hasPrevious()
          
 int nextIndex()
          
 T previous()
          
 int previousIndex()
          
 void set(T e)
          
 
Methods inherited from class com.springsource.util.common.SynchronizedIterator
hasNext, next, remove
 
Methods inherited from class com.springsource.util.common.SynchronizedObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.ListIterator
hasNext, next, remove
 

Field Detail

monitor

private final java.lang.Object monitor

listIterator

private final java.util.ListIterator<T> listIterator
Constructor Detail

SynchronizedListIterator

public SynchronizedListIterator(java.util.ListIterator<T> listIterator,
                                java.lang.Object monitor)
Method Detail

add

public void add(T e)

Specified by:
add in interface java.util.ListIterator<T>

hasPrevious

public boolean hasPrevious()

Specified by:
hasPrevious in interface java.util.ListIterator<T>

nextIndex

public int nextIndex()

Specified by:
nextIndex in interface java.util.ListIterator<T>

previous

public T previous()

Specified by:
previous in interface java.util.ListIterator<T>

previousIndex

public int previousIndex()

Specified by:
previousIndex in interface java.util.ListIterator<T>

set

public void set(T e)

Specified by:
set in interface java.util.ListIterator<T>