/** * Returns the number of entries in the set. * @return the set's size. */ public int size() { return this._set.size(); }
/** * Returns a new array containing the values in the set. * * @return an <code>long[]</code> value */ public long[] toArray() { long[] result = new long[size()]; long[] set = _set; byte[] states = _states; for (int i = states.length, j = 0; i-- > 0;) { if (states[i] == FULL) { result[j++] = set[i]; } } return result; }
/** * Compares this set with another set 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 TLongHashSet)) { return false; } final TLongHashSet that = (TLongHashSet)other; if (that.size() != this.size()) { return false; } return forEach(new TLongProcedure() { public final boolean execute(long value) { return that.contains(value); } }); }
} else if (other instanceof Set) { Set that = (Set)other; if (that.size() != _set.size()) { return false; // different sizes, no need to compare } else { // now we have to do it the hard way