range method

IsoBitSet range(
  1. int fromInclusive,
  2. int toExclusive
)

A new set holding bits [fromInclusive, toExclusive) shifted down so that fromInclusive becomes bit 0 — the Java BitSet.get(int, int) contract.

Implementation

IsoBitSet range(int fromInclusive, int toExclusive) {
  final IsoBitSet out = IsoBitSet();
  for (final int bit in _bits) {
    if (bit >= fromInclusive && bit < toExclusive) out.set(bit - fromInclusive);
  }
  return out;
}