Package com.tangosol.util
Class SimpleLongArray.Iterator
- java.lang.Object
-
- com.tangosol.util.SimpleLongArray.Iterator
-
- All Implemented Interfaces:
LongArray.Iterator,Iterator
- Enclosing class:
- SimpleLongArray
public class SimpleLongArray.Iterator extends Object implements LongArray.Iterator
An Iterator that adds a "current element" concept, similar to theMap.Entryinterface.
-
-
Constructor Summary
Constructors Constructor Description Iterator(int iNext, boolean fForward)Construct an iterator that will iterate over the SimpleLongArray starting with the specified index.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetIndex()Returns the index of the current value, which is the value returned by the most recent call to the next method.ObjectgetValue()Returns the current value, which is the same value returned by the most recent call to the next method, or the most recent value passed to setValue if setValue were called after the next method.booleanhasNext()Returns true if the iteration has more elements.Objectnext()Returns the next element in the iteration.voidremove()Removes from the underlying collection the last element returned by the iterator (optional operation).ObjectsetValue(Object oValue)Stores a new value at the current value index, returning the value that was replaced.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
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:
hasNextin interfaceIterator- Specified by:
hasNextin interfaceLongArray.Iterator- Returns:
- true if the iterator has more elements
-
next
public Object next()
Returns the next element in the iteration.- Specified by:
nextin interfaceIterator- Specified by:
nextin interfaceLongArray.Iterator- Returns:
- the next element in the iteration
- Throws:
NoSuchElementException- iteration has no more elements
-
getIndex
public long getIndex()
Returns the index of the current value, which is the value returned by the most recent call to the next method.- Specified by:
getIndexin interfaceLongArray.Iterator- Returns:
- the index of the current value
- Throws:
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.
-
getValue
public Object getValue()
Returns the current value, which is the same value returned by the most recent call to the next method, or the most recent value passed to setValue if setValue were called after the next method.- Specified by:
getValuein interfaceLongArray.Iterator- Returns:
- the current value
- Throws:
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.
-
setValue
public Object setValue(Object oValue)
Stores a new value at the current value index, returning the value that was replaced. The index of the current value is obtainable by calling the getIndex method.- Specified by:
setValuein interfaceLongArray.Iterator- Parameters:
oValue- the new value to store- Returns:
- the replaced value
- Throws:
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.
-
remove
public void remove()
Removes from the underlying collection the last element returned by the iterator (optional operation). This method can be called only once per call to next. The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.- Specified by:
removein interfaceIterator- Specified by:
removein interfaceLongArray.Iterator- Throws:
UnsupportedOperationException- if the remove operation is not supported by this IteratorIllegalStateException- 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.
-
-