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(java.util.BitSet set)
Construct an iterator over a bit set.
|
BitSetIterator(java.util.BitSet set,
int start)
Construct an iterator over a bit set, starting at a desired index.
|
BitSetIterator(java.util.BitSet set,
int start,
int end)
Create an iterator starting at a particular bit and ending at another index.
|
BitSetIterator(java.util.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, previousnext, remove, skipclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitskipskippublic BitSetIterator(java.util.BitSet set)
set - The set to iterate.public BitSetIterator(java.util.BitSet set,
int start)
set - The set to iterate.start - The first bit to return.public BitSetIterator(java.util.BitSet set,
int start,
int end)
set - The bit set to wrap.start - The start index, inclusive.end - The end index, exclusive.public BitSetIterator(java.util.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 IntIteratornextInt in class AbstractIntIteratorpublic int previousInt()
previousInt in interface IntBidirectionalIteratorpreviousInt in class AbstractIntBidirectionalIterator