Java Code Examples for org.eclipse.collections.impl.map.mutable.primitive.IntObjectHashMap#put()
The following examples show how to use
org.eclipse.collections.impl.map.mutable.primitive.IntObjectHashMap#put() .
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: SerializationUtils.java From exchange-core with Apache License 2.0 | 5 votes |
public static <T> IntObjectHashMap<T> readIntHashMap(final BytesIn bytes, final Function<BytesIn, T> creator) { int length = bytes.readInt(); final IntObjectHashMap<T> hashMap = new IntObjectHashMap<>(length); for (int i = 0; i < length; i++) { hashMap.put(bytes.readInt(), creator.apply(bytes)); } return hashMap; }
Example 2
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 3
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; }
Example 4
Source File: GsIntObjectMapTest.java From hashmapTest with The Unlicense | 5 votes |
@Override public int test() { final IntObjectHashMap<Integer> m_map = new IntObjectHashMap<>( m_keys.length ); for ( int i = 0; i < m_keys.length; ++i ) m_map.put( m_keys[ i ], null ); for ( int i = 0; i < m_keys.length; ++i ) m_map.put( m_keys[ i ], null ); return m_map.size(); }
Example 5
Source File: GsIntObjectMapTest.java From hashmapTest with The Unlicense | 5 votes |
@Override public int test() { final IntObjectHashMap<Integer> m_map = new IntObjectHashMap<>( m_keys.length / 2 + 1 ); final Integer value = 1; int add = 0, remove = 0; while ( add < m_keys.length ) { m_map.put( m_keys[ add ], value ); ++add; m_map.put( m_keys[ add ], value ); ++add; m_map.remove( m_keys[ remove++ ] ); } return m_map.size(); }