@Override public boolean apply(long key) { list.add(get(key)); return true; } }
@Override public boolean apply(long key, Object value) { return containsKey(key) && get(key) == value; } }
@Override public boolean apply(long key, Object value) { return other.containsKey(key) && other.get(key) == value; } }
@Override public boolean apply(long key) { return procedure.apply(key, get(key)); } }
/** * Returns a string representation of the receiver, containing the String representation of each key-value pair, * sorted ascending by key. */ public String toString() { LongArrayList theKeys = keys(); theKeys.sort(); StringBuilder buf = new StringBuilder(); buf.append('['); int maxIndex = theKeys.size() - 1; for (int i = 0; i <= maxIndex; i++) { long key = theKeys.get(i); buf.append(String.valueOf(key)); buf.append("->"); buf.append(String.valueOf(get(key))); if (i < maxIndex) { buf.append(", "); } } buf.append(']'); return buf.toString(); }
/** * Returns a string representation of the receiver, containing the String representation of each key-value pair, * sorted ascending by value, according to natural ordering. */ public String toStringByValue() { LongArrayList theKeys = new LongArrayList(); keysSortedByValue(theKeys); StringBuilder buf = new StringBuilder(); buf.append('['); int maxIndex = theKeys.size() - 1; for (int i = 0; i <= maxIndex; i++) { long key = theKeys.get(i); buf.append(String.valueOf(key)); buf.append("->"); buf.append(String.valueOf(get(key))); if (i < maxIndex) { buf.append(", "); } } buf.append(']'); return buf.toString(); }
/** * Fills all keys and values <i>sorted ascending by key</i> into the specified lists. Fills into the lists, starting * at index 0. After this call returns the specified lists both have a new size that equals <tt>this.size()</tt>. <p> * <b>Example:</b> <br> <tt>keys = (8,7,6), values = (1,2,2) --> keyList = (6,7,8), valueList = (2,2,1)</tt> * * @param keyList the list to be filled with keys, can have any size. * @param valueList the list to be filled with values, can have any size. */ @SuppressWarnings("unchecked") public void pairsSortedByKey(LongArrayList keyList, List<T> valueList) { keys(keyList); keyList.sort(); // the following is straightforward if not the most space-efficient possibility Object[] tempValueList = new Object[keyList.size()]; for (int i = keyList.size(); --i >= 0;) { tempValueList[i] = get(keyList.getQuick(i)); } valueList.clear(); for (Object value : tempValueList) { valueList.add((T) value); } }
@Override public boolean apply(long key) { list.add(get(key)); return true; } }
@Override public boolean apply(long key) { list.add(get(key)); return true; } }
@Override public boolean apply(long key) { return procedure.apply(key, get(key)); } }
@Override public boolean apply(long key, Object value) { return containsKey(key) && get(key) == value; } }
@Override public boolean apply(long key) { return procedure.apply(key, get(key)); } }
@Override public boolean apply(long key, Object value) { return other.containsKey(key) && other.get(key) == value; } }
@Override public boolean apply(long key, Object value) { return containsKey(key) && get(key) == value; } }
@Override public boolean apply(long key, Object value) { return other.containsKey(key) && other.get(key) == value; } }
/** * Returns a string representation of the receiver, containing the String representation of each key-value pair, * sorted ascending by value, according to natural ordering. */ public String toStringByValue() { LongArrayList theKeys = new LongArrayList(); keysSortedByValue(theKeys); StringBuilder buf = new StringBuilder(); buf.append('['); int maxIndex = theKeys.size() - 1; for (int i = 0; i <= maxIndex; i++) { long key = theKeys.get(i); buf.append(String.valueOf(key)); buf.append("->"); buf.append(String.valueOf(get(key))); if (i < maxIndex) { buf.append(", "); } } buf.append(']'); return buf.toString(); }
/** * Returns a string representation of the receiver, containing the String representation of each key-value pair, * sorted ascending by key. */ public String toString() { LongArrayList theKeys = keys(); theKeys.sort(); StringBuilder buf = new StringBuilder(); buf.append('['); int maxIndex = theKeys.size() - 1; for (int i = 0; i <= maxIndex; i++) { long key = theKeys.get(i); buf.append(String.valueOf(key)); buf.append("->"); buf.append(String.valueOf(get(key))); if (i < maxIndex) { buf.append(", "); } } buf.append(']'); return buf.toString(); }
/** * Returns a string representation of the receiver, containing the String representation of each key-value pair, * sorted ascending by value, according to natural ordering. */ public String toStringByValue() { LongArrayList theKeys = new LongArrayList(); keysSortedByValue(theKeys); StringBuilder buf = new StringBuilder(); buf.append('['); int maxIndex = theKeys.size() - 1; for (int i = 0; i <= maxIndex; i++) { long key = theKeys.get(i); buf.append(String.valueOf(key)); buf.append("->"); buf.append(String.valueOf(get(key))); if (i < maxIndex) { buf.append(", "); } } buf.append(']'); return buf.toString(); }
/** * Returns a string representation of the receiver, containing the String representation of each key-value pair, * sorted ascending by key. */ public String toString() { LongArrayList theKeys = keys(); theKeys.sort(); StringBuilder buf = new StringBuilder(); buf.append('['); int maxIndex = theKeys.size() - 1; for (int i = 0; i <= maxIndex; i++) { long key = theKeys.get(i); buf.append(String.valueOf(key)); buf.append("->"); buf.append(String.valueOf(get(key))); if (i < maxIndex) { buf.append(", "); } } buf.append(']'); return buf.toString(); }
/** * Fills all keys and values <i>sorted ascending by key</i> into the specified lists. Fills into the lists, starting * at index 0. After this call returns the specified lists both have a new size that equals <tt>this.size()</tt>. <p> * <b>Example:</b> <br> <tt>keys = (8,7,6), values = (1,2,2) --> keyList = (6,7,8), valueList = (2,2,1)</tt> * * @param keyList the list to be filled with keys, can have any size. * @param valueList the list to be filled with values, can have any size. */ @SuppressWarnings("unchecked") public void pairsSortedByKey(LongArrayList keyList, List<T> valueList) { keys(keyList); keyList.sort(); // the following is straightforward if not the most space-efficient possibility T[] tempValueList = (T[]) new Object[keyList.size()]; for (int i = keyList.size(); --i >= 0;) { tempValueList[i] = get(keyList.getQuick(i)); } valueList.clear(); for (T value : tempValueList) { valueList.add(value); } }