Class TwoSizesLongBigList

All Implemented Interfaces:
BigList<Long>, LongBigList, LongCollection, LongIterable, LongStack, Size64, Stack<Long>, Serializable, Comparable<BigList<? extends Long>>, Iterable<Long>, Collection<Long>

public class TwoSizesLongBigList extends AbstractLongBigList implements Serializable
A compressed big list of longs; small elements and large elements are stored separately, using two different, optimally chosen bit sizes.

Instances of this class store in a compacted form a list of natural numbers. Values are provided either through an iterable object. You will obtain a reduction in size only if the distribution of the values of the list is skewed towards small values.

Implementation details

Instances of this class store elements in two different LongArrayBitVector-based lists—one for large values and one for small values. The threshold between large and small is established by measuring at construction time the most proficuous choice. A ranking structure built on a marker array (recording which elements are stored in the large list) provides access of the correct element in each array.

See Also:
  • Constructor Details

    • TwoSizesLongBigList

      public TwoSizesLongBigList(IntIterable elements)
      Builds a new two-sizes long big list using a given iterable object.
      Parameters:
      elements - an iterable object.
    • TwoSizesLongBigList

      public TwoSizesLongBigList(ShortIterable elements)
      Builds a new two-sizes long big list using a given iterable object.
      Parameters:
      elements - an iterable object.
    • TwoSizesLongBigList

      public TwoSizesLongBigList(ByteIterable elements)
      Builds a new two-sizes long big list using a given iterable object.
      Parameters:
      elements - an iterable object.
    • TwoSizesLongBigList

      public TwoSizesLongBigList(LongIterable elements)
      Builds a new two-sizes long big list using a given iterable object.
      Parameters:
      elements - an iterable object.
  • Method Details

    • getLong

      public long getLong(long index)
      Specified by:
      getLong in interface LongBigList
    • size64

      public long size64()
      Specified by:
      size64 in interface Size64
    • numBits

      public long numBits()