/** * Creates a new hash set and fills it with the elements of a given array. * * @param a * an array whose elements will be used to fill the set. * @param offset * the first element to use. * @param length * the number of elements to use. * @param f * the load factor. */ public LongLinkedOpenHashSet(final long[] a, final int offset, final int length, final float f) { this(length < 0 ? 0 : length, f); LongArrays.ensureOffsetLength(a, offset, length); for (int i = 0; i < length; i++) add(a[offset + i]); } /**
/** * Creates a new hash set using elements provided by a type-specific iterator. * * @param i * a type-specific iterator whose elements will fill the set. * @param f * the load factor. */ public LongLinkedOpenHashSet(final LongIterator i, final float f) { this(DEFAULT_INITIAL_SIZE, f); while (i.hasNext()) add(i.nextLong()); } /**
public synchronized void add(long uid) { if (elems.size() == capacity) { elems.remove(elems.firstLong()); } elems.add(uid); }