All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vladsch.flexmark.util.collection.iteration.BitSetIterable Maven / Gradle / Ivy

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);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy