Java Code Examples for com.carrotsearch.hppc.ObjectIntHashMap#put()
The following examples show how to use
com.carrotsearch.hppc.ObjectIntHashMap#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: HppcObjectIntMapTest.java From hashmapTest with The Unlicense | 5 votes |
@Override public int test() { final ObjectIntHashMap<Integer> m_map = new ObjectIntHashMap<>( m_keys.length, m_fillFactor ); for ( int i = 0; i < m_keys.length; ++i ) m_map.put( m_keys[ i ], i ); for ( int i = 0; i < m_keys2.length; ++i ) m_map.put( m_keys2[ i ], i ); return m_map.size(); }
Example 2
Source File: HppcObjectIntMapTest.java From hashmapTest with The Unlicense | 5 votes |
@Override public int test() { final ObjectIntHashMap<Integer> m_map = new ObjectIntHashMap<>( m_keys.length / 2 + 1, m_fillFactor ); int add = 0, remove = 0; while ( add < m_keys.length ) { m_map.put( m_keys[ add ], add ); ++add; m_map.put( m_keys[ add ], add ); ++add; m_map.remove( m_keys[ remove++ ] ); } return m_map.size(); }
Example 3
Source File: JoinOrderingTest.java From crate with Apache License 2.0 | 5 votes |
@Test public void testFindFirstJoinPair() { // SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t2.id = t3.id AND t3.id = t4.id ObjectIntHashMap<RelationName> occurrences = new ObjectIntHashMap<>(4); occurrences.put(T3.T1, 1); occurrences.put(T3.T2, 1); occurrences.put(T3.T3, 3); occurrences.put(T3.T4, 1); ArrayList<Set<RelationName>> joinPairs = new ArrayList<>(); joinPairs.add(Set.of(T3.T1, T3.T2)); joinPairs.add(Set.of(T3.T2, T3.T3)); joinPairs.add(Set.of(T3.T3, T3.T4)); assertThat(JoinOrdering.findAndRemoveFirstJoinPair(occurrences, joinPairs), is(Set.of(T3.T2, T3.T3))); }
Example 4
Source File: JoinOrderingTest.java From crate with Apache License 2.0 | 5 votes |
@Test public void testFindFirstJoinPairOnlyOneOccurrence() { // SELECT * FROM t1, t2, t3 WHERE t1.id = t2.id AND t3.id = t4.id ObjectIntHashMap<RelationName> occurrences = new ObjectIntHashMap<>(4); occurrences.put(T3.T1, 1); occurrences.put(T3.T2, 1); occurrences.put(T3.T3, 1); occurrences.put(T3.T4, 1); Set<Set<RelationName>> sets = Sets.newLinkedHashSet(); sets.add(Set.of(T3.T1, T3.T2)); sets.add(Set.of(T3.T2, T3.T3)); sets.add(Set.of(T3.T3, T3.T4)); assertThat(JoinOrdering.findAndRemoveFirstJoinPair(occurrences, sets), is(Set.of(T3.T1, T3.T2))); }