/** * Wraps a given array into an array list. * * <p> * Note it is guaranteed that the type of the array returned by * {@link #elements()} will be the same (see the comments in the class * documentation). * * @param a * an array to wrap. * @return a new array list wrapping the given array. */ public static ShortArrayList wrap(final short a[]) { return wrap(a, a.length); } /**
@Override public String toString() { final StringBuffer s = new StringBuffer(); s.append("["); for (int i = 0; i < n; i++) { if (i != 0) s.append(", "); s.append(ShortArrayList.wrap(getArray(i)).toString()); } s.append("]"); return s.toString(); } /**
@Override public ShortColumn unique() { Selection selection = new BitmapBackedSelection(); for (short i : data) { selection.add(i); } int[] ints = selection.toArray(); short[] shorts = new short[ints.length]; for (int i = 0; i < ints.length; i++) { shorts[i] = (short) ints[i]; } return ShortColumn.create(name() + " Unique values", ShortArrayList.wrap(shorts)); }