Package org.carrot2.util
Class IntMapUtils
java.lang.Object
org.carrot2.util.IntMapUtils
public final class IntMapUtils extends Object
A number of utilities for working with
IntIntHashMap
s.-
Method Summary
Modifier and Type Method Description static com.carrotsearch.hppc.IntIntHashMap
addAllFromFlattened(com.carrotsearch.hppc.IntIntHashMap map, int[] flattened)
Adds all entries from a flat [] array to the provided map.static int[]
flatten(com.carrotsearch.hppc.IntIntHashMap map)
Converts anIntIntHashMap
into a flat int [] array.static int[]
flattenSortedByKey(com.carrotsearch.hppc.IntIntHashMap map)
Converts anIntIntHashMap
into a flat int [] array.
-
Method Details
-
flattenSortedByKey
public static final int[] flattenSortedByKey(com.carrotsearch.hppc.IntIntHashMap map)Converts anIntIntHashMap
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 anIntIntHashMap
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
-