Java Code Examples for org.eclipse.collections.impl.map.mutable.primitive.IntObjectHashMap#compact()
The following examples show how to use
org.eclipse.collections.impl.map.mutable.primitive.IntObjectHashMap#compact() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConjunctionIndex.java From vespa with Apache License 2.0 | 5 votes |
public static ConjunctionIndex fromInputStream(DataInputStream in) throws IOException { int[] zList = SerializationHelper.readIntArray(in); long[] idMapping = SerializationHelper.readLongArray(in); int kIndexSize = in.readInt(); IntObjectHashMap<FeatureIndex> kIndex = new IntObjectHashMap<>(kIndexSize); for (int i = 0; i < kIndexSize; i++) { int key = in.readInt(); kIndex.put(key, FeatureIndex.fromInputStream(in)); } kIndex.compact(); return new ConjunctionIndex(kIndex, zList, idMapping); }
Example 2
Source File: ConjunctionIndexBuilder.java From vespa with Apache License 2.0 | 5 votes |
private static IntObjectMap<ConjunctionIndex.FeatureIndex> buildKIndex(HashMap<Integer, FeatureIndexBuilder> kIndexBuilder) { IntObjectHashMap<ConjunctionIndex.FeatureIndex> map = new IntObjectHashMap<>(); for (Map.Entry<Integer, FeatureIndexBuilder> entry : kIndexBuilder.entrySet()) { map.put(entry.getKey(), buildFeatureIndex(entry.getValue())); } map.compact(); return map; }