Package org.apache.mahout.math.list

Examples of org.apache.mahout.math.list.CharArrayList


   * (8,6,7)</tt>
   *
   * @param keyList the list to be filled, can have any size.
   */
  public void keysSortedByValue(DoubleArrayList keyList) {
    pairsSortedByValue(keyList, new CharArrayList(size()));
  }
View Full Code Here


   * #forEachKey(DoubleProcedure)}. <p> This method can be used to iterate over the values of the receiver.
   *
   * @return the values.
   */
  public CharArrayList values() {
    CharArrayList list = new CharArrayList(size());
    values(list);
    return list;
  }
View Full Code Here

        assertFalse(map.containsValue((short) 23));
    }

    @Test
    public void testForEachKey() {
        final CharArrayList keys = new CharArrayList();
        HashCharShortMap map = newMutableMap();
        map.put((char) 11, (short) 22);
        map.put((char) 12, (short) 23);
        map.put((char) 13, (short) 24);
        map.put((char) 14, (short) 25);
        map.remove((char) 13);
        map.keySet().forEachWhile(new CharPredicate() {

            @Override
            public boolean test(char element) {
                keys.add(element);
                return true;
            }
        });

        char[] keysArray = keys.toArray(new char[keys.size()]);
        Arrays.sort(keysArray);

        assertArrayEquals(new char[] {11, 12, 14}, keysArray /* keyEpsilon */);
    }
View Full Code Here

    @Test
    public void testKeys() {
        HashCharShortMap map = newMutableMap();
        map.put((char) 11, (short) 22);
        map.put((char) 12, (short) 22);
        CharArrayList keys = new CharArrayList(map.keySet().toCharArray());
        keys.sort();
        assertEquals(11, keys.get(0) /* keyEpsilon */);
        assertEquals(12, keys.get(1) /* keyEpsilon */);
    }
View Full Code Here

            @Override
            public boolean test(char first, short second) {
                return (first % 2) != 0;
            }
        });
        CharArrayList keyList = new CharArrayList(map.keySet().toCharArray());
        keyList.sort();
        ShortArrayList valueList = new ShortArrayList(map.values().toShortArray());
        valueList.sort();
        assertEquals(2, keyList.size());
        assertEquals(2, valueList.size());
        assertEquals(12, keyList.get(0) /* keyEpsilon */);
        assertEquals(14, keyList.get(1) /* keyEpsilon */);
        assertEquals(23, valueList.get(0) /* valueEpsilon */);
        assertEquals(25, valueList.get(1) /* valueEpsilon */);
    }
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.list.CharArrayList

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.