Class BitSetIterator

java.lang.Object
com.carrotsearch.hppc.BitSetIterator

public class BitSetIterator extends Object
An iterator to iterate over set bits in an BitSet. This is faster than nextSetBit() for iterating over the complete set of bits, especially when the density of the bits set is high.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final long[]
    the python code that generated bitlist def bits2int(val): arr=0 for shift in range(8,0,-1): if val & 0x80: arr = (arr << 4) | shift val = val << 1 return arr def int_table(): tbl = [ hex(bits2int(val)).strip('L') for val in range(256) ] return ','.join(tbl)
    (package private) static final int[]
     
    private int
     
    private int
     
    static final int
     
    private long
     
    private final int
     
    private int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    BitSetIterator(long[] bits, int numWords)
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    private void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • bitlist

      static final int[] bitlist
    • arr

      private final long[] arr
      the python code that generated bitlist def bits2int(val): arr=0 for shift in range(8,0,-1): if val & 0x80: arr = (arr << 4) | shift val = val << 1 return arr def int_table(): tbl = [ hex(bits2int(val)).strip('L') for val in range(256) ] return ','.join(tbl)
    • words

      private final int words
    • i

      private int i
    • word

      private long word
    • wordShift

      private int wordShift
    • indexArray

      private int indexArray
    • NO_MORE

      public static final int NO_MORE
      See Also:
  • Constructor Details

    • BitSetIterator

      public BitSetIterator(BitSet obs)
    • BitSetIterator

      public BitSetIterator(long[] bits, int numWords)
  • Method Details

    • shift

      private void shift()
    • nextSetBit

      public int nextSetBit()