Class IntMapUtils


  • public final class IntMapUtils
    extends Object
    A number of utilities for working with IntIntHashMaps.
    • Method Detail

      • flattenSortedByKey

        public static final int[] flattenSortedByKey​(com.carrotsearch.hppc.IntIntHashMap map)
        Converts an IntIntHashMap into a flat int [] array. The returned arrays contains [key,value] pairs and is sorted in ascending order by key values.
      • flatten

        public static final int[] flatten​(com.carrotsearch.hppc.IntIntHashMap map)
        Converts an IntIntHashMap into a flat int [] array. Even indexes in the flat array represent keys and the corresponding odd indexes -- values. Note: the order of keys in the flat array is arbitrary.
      • addAllFromFlattened

        public static final com.carrotsearch.hppc.IntIntHashMap addAllFromFlattened​(com.carrotsearch.hppc.IntIntHashMap map,
                                                                                    int[] flattened)
        Adds all entries from a flat [] array to the provided map. Even indexes in the flat array represent keys and the corresponding odd indexes -- values.
        Returns:
        the input map for convenience