org.carrot2.util
Class IntMapUtils

java.lang.Object
  extended by org.carrot2.util.IntMapUtils

public final class IntMapUtils
extends Object

A number of utilities for working with IntIntOpenHashMaps.


Method Summary
static com.carrotsearch.hppc.IntIntOpenHashMap addAllFromFlattened(com.carrotsearch.hppc.IntIntOpenHashMap map, int[] flattened)
          Adds all entries from a flat [] array to the provided map.
static int[] flatten(com.carrotsearch.hppc.IntIntOpenHashMap map)
          Converts an IntIntOpenHashMap into a flat int [] array.
static int[] flattenSortedByKey(com.carrotsearch.hppc.IntIntOpenHashMap map)
          Converts an IntIntOpenHashMap into a flat int [] array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

flattenSortedByKey

public static final int[] flattenSortedByKey(com.carrotsearch.hppc.IntIntOpenHashMap map)
Converts an IntIntOpenHashMap 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.IntIntOpenHashMap map)
Converts an IntIntOpenHashMap 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.IntIntOpenHashMap addAllFromFlattened(com.carrotsearch.hppc.IntIntOpenHashMap 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


Copyright (c) Dawid Weiss, Stanislaw Osinski