/** * Returns a list filled with all keys contained in the receiver. The returned list has a size that equals * <tt>this.size()</tt>. Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link * #forEachKey(ByteProcedure)}. <p> This method can be used to iterate over the keys of the receiver. * * @return the keys. */ public ByteArrayList keys() { ByteArrayList list = new ByteArrayList(size()); keys(list); return list; }
/** * Returns a string representation of the receiver, containing the String representation of each key-value pair, * sorted ascending by key. */ public String toString() { ByteArrayList theKeys = keys(); //theKeys.sort(); StringBuilder buf = new StringBuilder(); buf.append('['); int maxIndex = theKeys.size() - 1; for (int i = 0; i <= maxIndex; i++) { byte 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(); }
keys(keyList); values(valueList);
/** * 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. */ public void pairsSortedByKey(ByteArrayList keyList, LongArrayList valueList) { keys(keyList); keyList.sort(); valueList.setSize(keyList.size()); for (int i = keyList.size(); --i >= 0;) { valueList.setQuick(i, get(keyList.getQuick(i))); } }
/** * Returns a list filled with all keys contained in the receiver. The returned list has a size that equals * <tt>this.size()</tt>. Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link * #forEachKey(ByteProcedure)}. <p> This method can be used to iterate over the keys of the receiver. * * @return the keys. */ public ByteArrayList keys() { ByteArrayList list = new ByteArrayList(size()); keys(list); return list; }
/** * Returns a string representation of the receiver, containing the String representation of each key-value pair, * sorted ascending by key. */ public String toString() { ByteArrayList theKeys = keys(); //theKeys.sort(); StringBuilder buf = new StringBuilder(); buf.append('['); int maxIndex = theKeys.size() - 1; for (int i = 0; i <= maxIndex; i++) { byte 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() { ByteArrayList theKeys = keys(); //theKeys.sort(); StringBuilder buf = new StringBuilder(); buf.append('['); int maxIndex = theKeys.size() - 1; for (int i = 0; i <= maxIndex; i++) { byte 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 list filled with all keys contained in the receiver. The returned list has a size that equals * <tt>this.size()</tt>. Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link * #forEachKey(ByteProcedure)}. <p> This method can be used to iterate over the keys of the receiver. * * @return the keys. */ public ByteArrayList keys() { ByteArrayList list = new ByteArrayList(size()); keys(list); return list; }
keys(keyList); values(valueList);
/** * 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. */ public void pairsSortedByKey(ByteArrayList keyList, LongArrayList valueList) { keys(keyList); keyList.sort(); valueList.setSize(keyList.size()); for (int i = keyList.size(); --i >= 0;) { valueList.setQuick(i, get(keyList.getQuick(i))); } }
keys(keyList); values(valueList);
/** * 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. */ public void pairsSortedByKey(ByteArrayList keyList, LongArrayList valueList) { keys(keyList); keyList.sort(); valueList.setSize(keyList.size()); for (int i = keyList.size(); --i >= 0;) { valueList.setQuick(i, get(keyList.getQuick(i))); } }