Package xbird.util.collections.longs

Examples of xbird.util.collections.longs.Long2LongOpenHash


                }
                final FastBufferedInputStream bis = new FastBufferedInputStream(fis, 4096);
                this.recordMap = ObjectUtils.readObjectQuietly(bis);
                IOUtils.closeQuietly(bis);
            } else {
                this.recordMap = new Long2LongOpenHash(cacheSize, 0.7f, 1.9f);
            }
            this.descFile = file;
        }
View Full Code Here


    }

    public void put(int times) {
        StopWatch sw = new StopWatch("[Long2LongOpenHashTest] testPut" + times);
        List<Long> keys = new ArrayList<Long>(times);
        Long2LongOpenHash hash = new Long2LongOpenHash(times);
        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));
        }
        Long2LongOpenHash copyed = ObjectUtils.deepCopy(hash);
        assertEquals(hash.size(), copyed.size());
        for(int i = 0; i < times; i++) {
            long key = keys.get(i).longValue();
            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.Long2LongOpenHash

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.