Class CompactArrayOfLongs


  • public abstract class CompactArrayOfLongs
    extends Object
    This class allows to create a set of arrays from the given collection of longs. Each array will represent a part of provided longs, each part has an offset and compressed array of ints which represents data. Compression is performed with help of JavaFastPFOR library: https://github.com/lemire/JavaFastPFOR On top of the compression the arrays are also pooled, as tests show that this reduces memory usage quite a bit.
    Since:
    2020.2
    • Constructor Detail

      • CompactArrayOfLongs

        public CompactArrayOfLongs()
    • Method Detail

      • create

        @NotNull
        public static List<CompactArrayOfLongs> create​(@NotNull
                                                       long[] sortedArray)
        Creates a list of compact arrays out of provided sorted array of longs. The provided array must be sorted in the ascending order (smaller values come first).
        Parameters:
        sortedArray - sorted array of longs
        Returns:
        list of objects which represent this array in a compressed form
      • asList

        @NotNull
        public abstract List<Long> asList()
      • array

        @NotNull
        public abstract long[] array()
      • size

        public abstract int size()
      • first

        public abstract long first()
      • last

        public abstract long last()
      • cleanupAndLogStatistics

        public static void cleanupAndLogStatistics()