Package xbird.util.collections.longs

Examples of xbird.util.collections.longs.Long2LongHash


    }

    public void put(int times) {
        StopWatch sw = new StopWatch("[Long2LongHashTest] testPut" + times);
        List<Long> keys = new ArrayList<Long>(times / 3);
        Long2LongHash hash = new Long2LongHash(times / 3);
        Random random = new Random(System.currentTimeMillis());
        for(int i = 0; i < times; i++) {
            long key = random.nextLong();
            keys.add(key);
            long value = random.nextLong();
            hash.put(key, value);
            assertEquals(value, hash.get(key));
        }
        Long2LongHash copyed = ObjectUtils.deepCopy(hash);
        assertEquals(hash.size(), copyed.size());
        for(int i = 0; i < times; i++) {
            long key = keys.get(i).longValue();
            assertEquals(hash.get(key), copyed.get(key));
            assertEquals("Round#" + i, hash.get(key), copyed.get(key));
        }
        System.err.println(sw);
    }
View Full Code Here

TOP

Related Classes of xbird.util.collections.longs.Long2LongHash

Copyright © 2018 www.massapicom. 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.