com.koloboke.collect.map
Interface IntShortCursor

All Superinterfaces:
Cursor

public interface IntShortCursor
extends Cursor

A mutable pointer to the entry in an iteration of entries with int keys and short values.

Basic IntShortCursor usage idiom is:

for (IntShortCursor cur = map.cursor(); cur.moveNext();) {
     // Work with cur.key() and cur.value()
     // Call cur.remove() to remove the current entry
 }

See the comparison of iteration ways in the library.

IntShortCursors of immutable maps don't support setValue(short) operation. More about mutability profiles.

See Also:
IntShortMap.cursor()

Method Summary
 void forEachForward(IntShortConsumer action)
          Performs the given action for each entry of the iteration after the cursor in forward direction until all entries have been processed or the action throws an exception.
 int key()
          Returns the key of the entry to which the cursor currently points.
 void setValue(short value)
          Replaces the value of the entry to which the cursor currently points (optional operation).
 short value()
          Returns the value of the entry to which the cursor currently points.
 
Methods inherited from interface com.koloboke.collect.Cursor
moveNext, remove
 

Method Detail

forEachForward

void forEachForward(@Nonnull
                    IntShortConsumer action)
Performs the given action for each entry of the iteration after the cursor in forward direction until all entries 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.key(), cur.value());

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

key

int key()
Returns the key of the entry to which the cursor currently points.

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

Returns:
the key of the entry to which the cursor currently points
Throws:
IllegalStateException - if this cursor is initially in front of the first entry 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

value

short value()
Returns the value of the entry to which the cursor currently points.

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

Returns:
the value of the entry to which the cursor currently points
Throws:
IllegalStateException - if this cursor is initially in front of the first entry 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

setValue

void setValue(short value)
Replaces the value of the entry to which the cursor currently points (optional operation).

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

Parameters:
value - new value to be stored in the entry to which the cursor currently points
Throws:
UnsupportedOperationException - if the setValue operation is not supported by this cursor
IllegalArgumentException - if some property this value prevents it from being stored in the entries of the iteration
IllegalStateException - if this cursor is initially in front of the first entry 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