Package com.carrotsearch.hppc

Examples of com.carrotsearch.hppc.IntCharOpenHashMap$ValuesContainer


public class IteratingOverMaps
{
    IntCharOpenHashMap prepare(int size)
    {
        final IntCharOpenHashMap map = new IntCharOpenHashMap(size);
        for (int i = 0; i < size / 2; i++)
        {
            map.put(i, (char)(64 + i));
        }
        return map;
    }
View Full Code Here


    @Test
    public void testIterableCursor()
    {
        // [[[start:iteration-maps-using-iterator]]]
        // Prepare some set to iterate over
        final IntCharOpenHashMap map = prepare(10);
       
        // Maps implement the Iterable interface that returns [keyType][valueType]Cursors
        // The cursor contains the key, value and internal index of the current element.
        for (IntCharCursor c : map)
        {
View Full Code Here

   
    @Test
    public void testWithProcedureClosure()
    {
        // [[[start:iteration-maps-using-procedures]]]
        final IntCharOpenHashMap map = prepare(10);

        // Maps also support iteration through [keyType][valueType]Procedure interfaces.
        // The apply() method will be called once for each key/value pair in the map.
       
        // Iteration from head to tail
        map.forEach(new IntCharProcedure()
        {
            public void apply(int key, char value)
            {
                System.out.println(key + " -> " + value);
            }
View Full Code Here

    @Test
    public void testDirectBufferLoop() throws Exception
    {
        // [[[start:iteration-maps-using-direct-buffer-access]]]
        final IntCharOpenHashMap map = prepare(10);
       
        // For the fastest iteration, you can access the sets's data buffers directly.
        final int [] keys = map.keys;
        final char [] values = map.values;
        final boolean [] states = map.allocated;
View Full Code Here

TOP

Related Classes of com.carrotsearch.hppc.IntCharOpenHashMap$ValuesContainer

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.