com.koloboke.collect
Interface LongCursor

All Superinterfaces:
Cursor

public interface LongCursor
extends Cursor

A mutable pointer to the element in an iteration of longs.

Basic LongCursor usage idiom is:

for (LongCursor cur = collection.cursor(); cur.moveNext();) {
     // Work with cur.elem()
     // Call cur.remove() to remove the current entry
 }

See Also:
LongCollection.cursor()

Method Summary
 long elem()
          Returns the element to which the cursor currently points.
 void forEachForward(LongConsumer action)
          Performs the given action for each element of the iteration after the cursor in forward direction until all elements have been processed or the action throws an exception.
 
Methods inherited from interface com.koloboke.collect.Cursor
moveNext, remove
 

Method Detail

forEachForward

void forEachForward(@Nonnull
                    LongConsumer action)
Performs the given action for each element of the iteration after the cursor in forward direction until all elements have been processed or the action throws an exception. Exceptions thrown by the action are relayed to the caller.

cur.forEachForward(action) is exact equivalent of

 while (cur.moveNext())
     action.accept(cur.elem());

Parameters:
action - the action to be performed for each element

elem

long elem()
Returns the element to which the cursor currently points.

Throws IllegalStateException, if the cursor isn't pointing to any element: if it is in front of the first element, after the last, or the current element has been removed using Cursor.remove() operation.

Returns:
the element to which the cursor currently points
Throws:
IllegalStateException - if this cursor is initially in front of the first element and Cursor.moveNext() hasn't been called yet, or the previous call of moveNext returned false, or remove() has been performed after the previous cursor movement