Package org.apache.mahout.math.list

Examples of org.apache.mahout.math.list.CharArrayList.sort()


   * Returns a string representation of the receiver, containing the String representation of each key-value pair,
   * sorted ascending by key.
   */
  public String toString() {
    CharArrayList theKeys = keys();
    theKeys.sort();

    StringBuilder buf = new StringBuilder();
    buf.append('[');
    int maxIndex = theKeys.size() - 1;
    for (int i = 0; i <= maxIndex; i++) {
View Full Code Here


    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 */);
    }

    @Test
View Full Code Here

            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 */);
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.