Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.util
Class AbstractStableIterator

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.AbstractStableIterator

All Implemented Interfaces:
java.util.Iterator
Direct Known Subclasses:
AbstractKeySetBasedMap.KeyIterator, BinaryRadixTree.KeyIterator, CompositeAddressProvider.AddressIterator, OverflowMap.EntrySet.EntrySetIterator, OverflowMap.InternalKeySet.InternalKeySetIterator, PartitionedIterator, PartitionSplittingBackingMap.PartitionedIterator, SafeHashMap.EntrySet.EntrySetIterator, SafeSortedMap.ViewMap.EntryIterator, SegmentedHashMap.EntrySet.EntrySetIterator

public abstract class AbstractStableIterator
extends Base
implements java.util.Iterator

An abstract Iterator implementation that is stable between the hasNext() and next() methods, and between the next() and remove() methods.

Since:
Coherence 3.1
Author:
cp 2003.05.24

Constructor Summary
AbstractStableIterator()
          Default constructor.

 

Method Summary
protected abstract  void advance()
          Advance to the next object.
protected  java.lang.Object getPrevious()
          Obtain the previous object provided by the Iterator.
 boolean hasNext()
          Returns true if the iteration has more elements.
 java.lang.Object next()
          Returns the next element in the iteration.
 void remove()
          Removes from the underlying collection the last element returned by the iterator.
protected  void remove(java.lang.Object oPrev)
          Remove the specified item.
protected  void setNext(java.lang.Object oNext)
          Specify the next object to provide from the Iterator.

 

Constructor Detail

AbstractStableIterator

public AbstractStableIterator()
Default constructor.

Method Detail

hasNext

public boolean hasNext()
Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)
Specified by:
hasNext in interface java.util.Iterator
Returns:
true if the iterator has more elements

next

public java.lang.Object next()
Returns the next element in the iteration.
Specified by:
next in interface java.util.Iterator
Returns:
the next element in the iteration
Throws:
java.util.NoSuchElementException - if the Iterator has no more elements

remove

public void remove()
Removes from the underlying collection the last element returned by the iterator.
Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.IllegalStateException - if the next method has not yet been called, or the remove method has already been called after the last call to the next method

getPrevious

protected java.lang.Object getPrevious()
Obtain the previous object provided by the Iterator.
Returns:
the object previously returned from a call to next()

setNext

protected void setNext(java.lang.Object oNext)
Specify the next object to provide from the Iterator.
Parameters:
oNext - the next object to provide from the Iterator

advance

protected abstract void advance()
Advance to the next object.

This method must be implemented by the concrete sub-class by calling setNext(java.lang.Object) if there is a next object.


remove

protected void remove(java.lang.Object oPrev)
Remove the specified item.

This is an optional operation. If the Iterator supports element removal, then it should implement this method, which is delegated to by the remove() method.

Parameters:
oPrev - the previously iterated object that should be removed
Throws:
java.lang.UnsupportedOperationException - if removal is not supported

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.