Package xbird.util.collections.ints.Int2LongHash

Examples of xbird.util.collections.ints.Int2LongHash.Int2LongLRUMap


    }

    @Test
    public void testPut() {
        final int limit = 4;
        Int2LongLRUMap lru = new Int2LongLRUMap(4);
        lru.put(0, 1L);
        lru.put(1, 2L);
        lru.put(2, 3L);
        lru.put(3, 4L);
        Assert.assertEquals(4L, lru.put(3, 5));
        Assert.assertEquals(-1L, lru.put(4, 5));
        Assert.assertEquals(limit, lru.size());
    }
View Full Code Here


        Assert.assertEquals(limit, lru.size());
    }

    @Test
    public void testGetPromotion() {
        Int2LongLRUMap map = new Int2LongLRUMap(3);
        map.put(1, 1L);
        map.put(2, 2L);
        map.put(3, 3L);
        // eviction order is now 1,2,3      
        map.get(1);
        // eviction order is now 2,3,1
        map.put(4, 4L);
        // 2 should be evicted (then 3,1,4)
        int[] keys = new int[3];
        int i = 0;
        for(Int2LongHash.BucketEntry e : map) {
            keys[i++] = e.key;
View Full Code Here

TOP

Related Classes of xbird.util.collections.ints.Int2LongHash.Int2LongLRUMap

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.