Examples of TIntLongHashMap


Examples of gnu.trove.map.hash.TIntLongHashMap

        assertNull( map.get( keys[3] ) );
    }


    public void testValues() {
        TIntLongMap raw_map = new TIntLongHashMap();
        Map<Integer,Long> map = TDecorators.wrap( raw_map );

        map.put( KEY_ONE, Long.valueOf( 1 ) );
        map.put( KEY_TWO, Long.valueOf( 2 ) );

        assertEquals( 2, map.size() );

        Long[] values = map.values().toArray( new Long[map.size()] );
        assertEquals( 2, values.length );
        List values_list = Arrays.asList( values );

        assertTrue( values_list.contains( Long.valueOf( 1 ) ) );
        assertTrue( values_list.contains( Long.valueOf( 2 ) ) );

        Long[] values2 = map.values().toArray( new Long[map.size()] );
        assertEquals( 2, values2.length );
        List<Long> keys_list2 = Arrays.asList( values2 );

        assertTrue( keys_list2.contains( Long.valueOf( 1 ) ) );
        assertTrue( keys_list2.contains( Long.valueOf( 2 ) ) );

        int element_count = 20;
        raw_map = new TIntLongHashMap( 20, 0.5f, Integer.MIN_VALUE, Long.MIN_VALUE );
        map = TDecorators.wrap( raw_map );
        for ( int i = 0; i < element_count; i++ ) {
            map.put( i, Long.valueOf( i * i ) );
        }
        assertEquals( element_count, map.size() );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.