org.millscript.commons.util.iterator
Class AbstractListIterator<V>

java.lang.Object
  extended by org.millscript.commons.util.iterator.AbstractMapIterator<java.lang.Integer,V>
      extended by org.millscript.commons.util.iterator.AbstractListIterator<V>
All Implemented Interfaces:
ListIterator<V>, MapIterator<java.lang.Integer,V>
Direct Known Subclasses:
AbstractEReferenceHashMap.HashMapKeysIterator, AbstractEReferenceHashMap.HashMapMapletIterator, AbstractEReferenceHashMap.HashMapValuesIterator, AbstractIList.ListMapletIterator, AbstractITreeMap.ITreeMapNodeListIterator, ArrayListIterator, EArrayList.EArrayListIterator, EBinaryTreeMap.NodeXIterator, EHashMap.HashMapKeysIterator, EHashMap.HashMapMapletIterator, EHashMap.HashMapValuesIterator, ELinkedHashMap.LinkedHashMapKeysIterator, ELinkedHashMap.LinkedHashMapMapletIterator, ELinkedHashMap.LinkedHashMapValuesIterator, ELinkedList.ELinkedListIterator, IArrayMap.SharedMapletListMapIterator, IArraySet.ArraySetMapletListIterator, IArraySet.SharedArraySetMapletListIterator, IDynamicList.DynamicListIterator, IHashMap.HashMapKeysIterator, IHashMap.HashMapMapletIterator, IHashMap.HashMapValuesIterator, IIntegerList.IntegerListIterator, IJavaUtilList.JavaUtilCollectionListIterator, ILinkedHashMap.LinkedHashMapKeysIterator, ILinkedHashMap.LinkedHashMapMapletIterator, ILinkedHashMap.LinkedHashMapValuesIterator, ILinkedList.ISharedLinkedListIterator, ILinkedList.LinkedListIterator, IMapletArrayMap.MapletArrayKeysMapIterator, IMapletArrayMap.MapletArrayValuesMapIterator, IMapletList.MapletListIterator, IStringList.StringListIterator, ITwoArrayMap.MapletListIterator, ITwoArrayMap.SharedMapletListIterator, NullListIterator, SharedArrayListIterator, SkippingArrayListIterator, SkippingSharedArrayListIterator, VariableLengthListIterator

public abstract class AbstractListIterator<V>
extends AbstractMapIterator<java.lang.Integer,V>
implements ListIterator<V>

The class provides a skeletal implementation of the list iterator interface, to help with custom implementations.

All you need to do is provide an implmentation for the AbstractMapIterator.getValue() and AbstractMapIterator.outOfBounds() methods.


Field Summary
protected  int position
          The current position(one based) in the iteration.
 
Constructor Summary
AbstractListIterator()
           
 
Method Summary
protected  void advance()
          Advances this iterator to its next point.
 Listlet<V> currentMaplet()
          Returns the current mapping in the iteration.
protected  java.lang.Integer getKey()
          Returns the key for the current mapping in the iteration.
protected  Listlet<V> getMaplet()
          Returns the current mapping in the iteration.
 Listlet<V> nextMaplet()
          Returns the next mapping in the iteration.
 
Methods inherited from class org.millscript.commons.util.iterator.AbstractMapIterator
currentKey, currentValue, getValue, nextKey, nextValue, outOfBounds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.millscript.commons.util.MapIterator
currentKey, currentValue, hasNext, nextKey, nextValue
 

Field Detail

position

protected int position
The current position(one based) in the iteration. As this is a one based position, the starting point of zero represents the imaginary position before the first element in the iteration.

Constructor Detail

AbstractListIterator

public AbstractListIterator()
Method Detail

advance

protected void advance()
Description copied from class: AbstractMapIterator
Advances this iterator to its next point. This method allows a common implementation of the next* methods, making it a little bit easier to implement the map iterator interface.

Specified by:
advance in class AbstractMapIterator<java.lang.Integer,V>
See Also:
AbstractMapIterator.advance()

getKey

protected java.lang.Integer getKey()
Description copied from class: AbstractMapIterator
Returns the key for the current mapping in the iteration. This method must be implemented by any concrete implementation and should not need to perform bounds checking.

Specified by:
getKey in class AbstractMapIterator<java.lang.Integer,V>
Returns:
the key for the current mapping
See Also:
AbstractMapIterator.getKey()

getMaplet

protected Listlet<V> getMaplet()
Description copied from class: AbstractMapIterator
Returns the current mapping in the iteration. This method must be implemented by any concrete implementation and should not need to perform bounds checking.

Overrides:
getMaplet in class AbstractMapIterator<java.lang.Integer,V>
Returns:
the Maplet for the current mapping
See Also:
AbstractMapIterator.getMaplet()

currentMaplet

public Listlet<V> currentMaplet()
Description copied from interface: MapIterator
Returns the current mapping in the iteration.

Specified by:
currentMaplet in interface ListIterator<V>
Specified by:
currentMaplet in interface MapIterator<java.lang.Integer,V>
Overrides:
currentMaplet in class AbstractMapIterator<java.lang.Integer,V>
Returns:
the Maplet for the current mapping
See Also:
MapIterator.currentMaplet()

nextMaplet

public Listlet<V> nextMaplet()
Description copied from interface: MapIterator
Returns the next mapping in the iteration.

Specified by:
nextMaplet in interface ListIterator<V>
Specified by:
nextMaplet in interface MapIterator<java.lang.Integer,V>
Overrides:
nextMaplet in class AbstractMapIterator<java.lang.Integer,V>
Returns:
the Maplet for the next mapping
See Also:
MapIterator.nextMaplet()


Copyright © 2005-2007 Open World Ltd. All Rights Reserved.