com.vladsch.flexmark.util.collection.iteration.BitSetIterable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flexmark-util-collection Show documentation
Show all versions of flexmark-util-collection Show documentation
flexmark-java collection utility classes
The newest version!
package com.vladsch.flexmark.util.collection.iteration;
import java.util.BitSet;
import org.jetbrains.annotations.NotNull;
public class BitSetIterable implements ReversibleIterable {
private final @NotNull BitSet bitSet;
private final boolean reversed;
public BitSetIterable(@NotNull BitSet bitSet) {
this(bitSet, false);
}
public BitSetIterable(@NotNull BitSet bitSet, boolean reversed) {
this.bitSet = bitSet;
this.reversed = reversed;
}
@Override
public boolean isReversed() {
return reversed;
}
@NotNull
@Override
public ReversibleIterator iterator() {
return new BitSetIterator(bitSet, reversed);
}
@NotNull
@Override
public ReversibleIterable reversed() {
return new BitSetIterable(bitSet, !reversed);
}
@NotNull
@Override
public ReversibleIterator reversedIterator() {
return new BitSetIterator(bitSet, !reversed);
}
}