public class IntBagIterator extends Object
IntBag
example use
IntBag ids; .... final IntBagIterator it = new IntBagIterator(ids); while (it.hasNext()) doSomething(it.next());
or
for (final IntBagIterator it = new IntBagIterator(ids); it.hasNext();) doSomething(it.next());
Modifier and Type | Class and Description |
---|---|
protected static class |
IntBagIterator.State |
Modifier and Type | Field and Description |
---|---|
protected int |
index |
protected int |
indexEnd |
protected IntBag |
intBag |
protected IntBagIterator.State |
state |
Constructor and Description |
---|
IntBagIterator(IntBag intBag)
Create iterator for IntBag
|
IntBagIterator(IntBag intBag,
int indexBegin)
Create iterator for IntBag
|
IntBagIterator(IntBag intBag,
int indexBegin,
int size)
Create iterator for IntBag
|
Modifier and Type | Method and Description |
---|---|
int |
getCurrentIndex()
return current index
This method can be called only per call to next().
|
boolean |
hasNext()
Returns true if the iteration has more elements.
|
int |
next()
Returns the next element in the iteration.
|
void |
remove()
Removes from the underlying collection the last element returned by this iterator (optional operation).
|
protected final IntBag intBag
protected int index
protected int indexEnd
protected IntBagIterator.State state
public IntBagIterator(IntBag intBag)
public IntBagIterator(IntBag intBag, int indexBegin)
public IntBagIterator(IntBag intBag, int indexBegin, int size)
public int getCurrentIndex()
IllegalStateException
- - if the next() method has not yet been calledpublic boolean hasNext()
public int next()
NoSuchElementException
- - if the iteration has no more elementspublic void remove()
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() methodCopyright © 2019. All rights reserved.