/** * Returns the values of the map. * * @return a <code>Collection</code> value */ public long[] getValues() { long[] vals = new long[size()]; long[] v = _values; byte[] states = _states; for (int i = v.length, j = 0; i-- > 0; ) { if (states[i] == FULL) { vals[j++] = v[i]; } } return vals; }
/** * returns the keys of the map. * * @return a <code>Set</code> value */ public short[] keys() { short[] keys = new short[size()]; short[] k = _set; byte[] states = _states; for (int i = k.length, j = 0; i-- > 0; ) { if (states[i] == FULL) { keys[j++] = k[i]; } } return keys; }
/** * returns the keys of the map. * * @param a the array into which the elements of the list are to be stored, if it is big enough; * otherwise, a new array of the same type is allocated for this purpose. * @return a <code>Set</code> value */ public short[] keys(short[] a) { int size = size(); if (a.length < size) { a = (short[]) java.lang.reflect.Array.newInstance( a.getClass().getComponentType(), size); } short[] k = (short[]) _set; for (int i = k.length, j = 0; i-- > 0; ) { if (k[i] != FREE && k[i] != REMOVED) { a[j++] = k[i]; } } return a; }
/** * Compares this map with another map for equality of their stored entries. * * @param other an <code>Object</code> value * @return a <code>boolean</code> value */ public boolean equals(Object other) { if (!(other instanceof TShortLongHashMap)) { return false; } TShortLongHashMap that = (TShortLongHashMap) other; if (that.size() != this.size()) { return false; } return forEachEntry(new EqProcedure(that)); }