Package org.apache.mahout.math.list

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


   * Returns a string representation of the receiver, containing the String representation of each key-value pair,
   * sorted ascending by key.
   */
  public String toString() {
    ShortArrayList 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


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

        map.put((char) 13, (short) 24);
        map.put((char) 14, (short) 25);
        map.remove((char) 13);
        ShortArrayList values = new ShortArrayList(map.values().toShortArray());
        assertEquals(3, values.size());
        values.sort();
        assertEquals(22, values.get(0) /* valueEpsilon */);
        assertEquals(23, values.get(1) /* valueEpsilon */);
        assertEquals(25, values.get(2) /* valueEpsilon */);
    }

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.