Class PointNIntIterator
java.lang.Object
com.github.yellowstonegames.grid.PointNIntIterator
public class PointNIntIterator
extends Object
implements com.github.tommyettinger.ds.support.util.IntIterator
An
IntIterator that iterates over the components in a PointNInt using PointNInt.get(int).-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPointNIntIterator(PointNInt<?, ?> pt) Constructs a new PointNIntIterator over the given PointNInt that starts at index 0. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()Returns true if the iteration has more elements.intnextInt()Returns the next int element in the iteration.voidreset()voidset(int newValue) AfternextInt()has been called, you can call this to change the value at the same position last returned by nextInt().Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.tommyettinger.ds.support.util.IntIterator
forEachRemaining, nextMethods inherited from interface Iterator
forEachRemaining, remove
-
Field Details
-
pt
The PointNInt this can iterate through. -
index
public int indexWhich index this will return next.
-
-
Constructor Details
-
PointNIntIterator
Constructs a new PointNIntIterator over the given PointNInt that starts at index 0.- Parameters:
pt- the PointNInt to iterate over
-
-
Method Details
-
nextInt
public int nextInt()Returns the next int element in the iteration. Unlike most IntIterator types, this typically won't throw an Exception if the iterator is exhausted. You should still usehasNext()to determine when the iterator has exhausted the available items.- Specified by:
nextIntin interfacecom.github.tommyettinger.ds.support.util.IntIterator- Returns:
- the next int element in the iteration
-
hasNext
-
set
public void set(int newValue) AfternextInt()has been called, you can call this to change the value at the same position last returned by nextInt(). If nextInt() has not yet been called, this does not have defined behavior, and is permitted to throw an Exception.- Parameters:
newValue- the value to use at the last returned index
-
reset
public void reset()
-