Package com.carrotsearch.hppc

Examples of com.carrotsearch.hppc.CharIntOpenHashMap$KeysIterator


        final char [] CHARS = DATA;
       
        // We'll use a char -> int map for counting. If you know the likely
        // number of distinct key values in the map, pass it to the constructor
        // to avoid resizing of the map.
        final CharIntOpenHashMap counts = new CharIntOpenHashMap(256);
       
        // Loop over the characters and increase their corresponding entries in the map
        for (int i = 0; i < CHARS.length; i++)
        {
            // Adds 1 if the entry exists, sets 1 if the entry does not exist
            counts.putOrAdd(CHARS[i], 1, 1);
        }
        // [[[end:character-counting]]]

        final TotalCounter counter = new TotalCounter();
        counts.forEach(counter);
        Assert.assertEquals(counter.total, DATA.length);
    }
View Full Code Here

TOP

Related Classes of com.carrotsearch.hppc.CharIntOpenHashMap$KeysIterator

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.