/** * 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(ObjectProcedure)}. <p> This method can be used to iterate over the keys of the receiver. * * @return the keys. */ public List<T> keys() { List<T> list = new ArrayList<T>(size()); keys(list); return list; }
/** * Returns a list filled with all values 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(ObjectProcedure)}. <p> This method can be used to iterate over the values of the receiver. * * @return the values. */ public ByteArrayList values() { ByteArrayList list = new ByteArrayList(size()); values(list); return list; }
/** * Fills all keys <i>sorted ascending by their associated value</i> into the specified list. Fills into the list, * starting at index 0. After this call returns the specified list has a new size that equals <tt>this.size()</tt>. * Primary sort criterium is "value", secondary sort criterium is "key". This means that if any two values are equal, * the smaller key comes first. <p> <b>Example:</b> <br> <tt>keys = (8,7,6), values = (1,2,2) --> keyList = * (8,6,7)</tt> * * @param keyList the list to be filled, can have any size. */ public void keysSortedByValue(List<T> keyList) { pairsSortedByValue(keyList, new ByteArrayList(size())); }
public int hashCode() { final int[] buf = new int[size()]; forEachPair( new ObjectByteProcedure<T>() { int i = 0; @Override public boolean apply(Object key, byte value) { buf[i++] = key.hashCode() ^ HashUtils.hash(value); return true; } } ); Arrays.sort(buf); return IntBuffer.wrap(buf).hashCode(); }
/** * 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(ObjectProcedure)}. <p> This method can be used to iterate over the keys of the receiver. * * @return the keys. */ public List<T> keys() { List<T> list = new ArrayList<T>(size()); keys(list); return list; }
/** * 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(ObjectProcedure)}. <p> This method can be used to iterate over the keys of the receiver. * * @return the keys. */ public List<T> keys() { List<T> list = new ArrayList<T>(size()); keys(list); return list; }
/** * Returns a list filled with all values 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(ObjectProcedure)}. <p> This method can be used to iterate over the values of the receiver. * * @return the values. */ public ByteArrayList values() { ByteArrayList list = new ByteArrayList(size()); values(list); return list; }
/** * Returns a list filled with all values 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(ObjectProcedure)}. <p> This method can be used to iterate over the values of the receiver. * * @return the values. */ public ByteArrayList values() { ByteArrayList list = new ByteArrayList(size()); values(list); return list; }
/** * Fills all keys <i>sorted ascending by their associated value</i> into the specified list. Fills into the list, * starting at index 0. After this call returns the specified list has a new size that equals <tt>this.size()</tt>. * Primary sort criterium is "value", secondary sort criterium is "key". This means that if any two values are equal, * the smaller key comes first. <p> <b>Example:</b> <br> <tt>keys = (8,7,6), values = (1,2,2) --> keyList = * (8,6,7)</tt> * * @param keyList the list to be filled, can have any size. */ public void keysSortedByValue(List<T> keyList) { pairsSortedByValue(keyList, new ByteArrayList(size())); }
/** * Fills all keys <i>sorted ascending by their associated value</i> into the specified list. Fills into the list, * starting at index 0. After this call returns the specified list has a new size that equals <tt>this.size()</tt>. * Primary sort criterium is "value", secondary sort criterium is "key". This means that if any two values are equal, * the smaller key comes first. <p> <b>Example:</b> <br> <tt>keys = (8,7,6), values = (1,2,2) --> keyList = * (8,6,7)</tt> * * @param keyList the list to be filled, can have any size. */ public void keysSortedByValue(List<T> keyList) { pairsSortedByValue(keyList, new ByteArrayList(size())); }
public int hashCode() { final int[] buf = new int[size()]; forEachPair( new ObjectByteProcedure<T>() { int i = 0; @Override public boolean apply(Object key, byte value) { buf[i++] = key.hashCode() ^ HashUtils.hash(value); return true; } } ); Arrays.sort(buf); return IntBuffer.wrap(buf).hashCode(); }