public final class BitSetIterator extends AbstractIntBidirectionalIterator
BitSet
, returning the indexes of the
set bits, in order from 0 to highest index of a set bit.Constructor and Description |
---|
BitSetIterator(BitSet set)
Construct an iterator over a bit set.
|
BitSetIterator(BitSet set,
int start)
Construct an iterator over a bit set, starting at a desired index.
|
BitSetIterator(BitSet set,
int start,
int end)
Create an iterator starting at a particular bit and ending at another index.
|
BitSetIterator(BitSet set,
int start,
int end,
int initial)
Create an iterator starting at a particular bit and ending at another index, with an initial
position that may not be at the beginning.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
boolean |
hasPrevious() |
int |
nextInt() |
int |
previousInt() |
back, previous
next, remove, skip
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
skip
skip
forEachRemaining, next, remove
public BitSetIterator(BitSet set)
set
- The set to iterate.public BitSetIterator(BitSet set, int start)
set
- The set to iterate.start
- The first bit to return.public BitSetIterator(BitSet set, int start, int end)
set
- The bit set to wrap.start
- The start index, inclusive.end
- The end index, exclusive.public BitSetIterator(BitSet set, int start, int end, int initial)
set
- The bit set to wrap.start
- The start index, inclusive.end
- The end index, exclusive.initial
- The initial position of the iterator. The first call to nextInt()
returns the first set bit such that bit >= initial
and
bit < end
.public boolean hasNext()
public boolean hasPrevious()
public int nextInt()
nextInt
in interface IntIterator
nextInt
in class AbstractIntIterator
public int previousInt()
previousInt
in interface IntBidirectionalIterator
previousInt
in class AbstractIntBidirectionalIterator