org.deduced.utilities
Class WeakList.WeakIterator<E>

java.lang.Object
  extended by org.deduced.utilities.WeakList.WeakIterator<E>
Type Parameters:
E - the type of element to iterate on
All Implemented Interfaces:
java.util.Iterator<E>
Enclosing class:
WeakList<E>

public static class WeakList.WeakIterator<E>
extends java.lang.Object
implements java.util.Iterator<E>

Class representing an iterator on a weak list. This iterator will check that objects haven't been garbage collected before returning the next() value.

Author:
Steve McDuff

Field Summary
private  java.util.Iterator<java.lang.ref.WeakReference<E>> iterator
          the actual iterator used to browse the list
private  E nextValue
          the current next value
 
Constructor Summary
WeakList.WeakIterator(java.util.Iterator<java.lang.ref.WeakReference<E>> setIterator)
          Constructor
 
Method Summary
private  void findNextValue()
          findNextValue
 boolean hasNext()
          (non-Javadoc)
 E next()
          (non-Javadoc)
 void remove()
          (non-Javadoc)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iterator

private java.util.Iterator<java.lang.ref.WeakReference<E>> iterator
the actual iterator used to browse the list


nextValue

private E nextValue
the current next value

Constructor Detail

WeakList.WeakIterator

public WeakList.WeakIterator(java.util.Iterator<java.lang.ref.WeakReference<E>> setIterator)
Constructor

Parameters:
setIterator - the actual iterator used to browse the list
Method Detail

findNextValue

private void findNextValue()
findNextValue


remove

public void remove()
(non-Javadoc)

Specified by:
remove in interface java.util.Iterator<E>
See Also:
Iterator.remove()

hasNext

public boolean hasNext()
(non-Javadoc)

Specified by:
hasNext in interface java.util.Iterator<E>
See Also:
Iterator.hasNext()

next

public E next()
(non-Javadoc)

Specified by:
next in interface java.util.Iterator<E>
See Also:
Iterator.next()