@Test public void testKeys() { LongHashSet set = new LongHashSet(); set.add(0); set.add(-98); set.add(666); set.add(Long.MAX_VALUE); set.remove(666); long[] keys = set.keys(); assertEquals(3, keys.length); Arrays.sort(keys); assertEquals(-98, keys[0]); assertEquals(0, keys[1]); assertEquals(Long.MAX_VALUE, keys[2]); }
public long[] keys() { long[] values = new long[size]; int idx = 0; for (Entry entry : table) { while (entry != null) { values[idx++] = entry.key; entry = entry.next; } } return values; }
LongHashSet { public long[] keys() { long[] values = new long[size]; int idx = 0; for (Entry entry : table) { while (entry != null) { values[idx++] = entry.key; entry = entry.next; } } return values; } }
LongHashSet { public long[] keys() { long[] values = new long[size]; int idx = 0; for (Entry entry : table) { while (entry != null) { values[idx++] = entry.key; entry = entry.next; } } return values; } LongHashSet(); @SuppressWarnings("unchecked")  LongHashSet(int capacity); }
LongHashSet { public long[] keys() { long[] values = new long[size]; int idx = 0; for (Entry entry : table) { while (entry != null) { values[idx++] = entry.key; entry = entry.next; } } return values; } LongHashSet(); @SuppressWarnings("unchecked")  LongHashSet(int capacity); static LongHashSet createSynchronized(); static LongHashSet createSynchronized(int capacity); boolean contains(long key); boolean add(long key); boolean remove(long key); long[] keys(); void clear(); int size(); void setCapacity(int newCapacity); void setLoadFactor(float loadFactor); void reserveRoom(int entryCount); }
LongHashSet { public long[] keys() { long[] values = new long[size]; int idx = 0; for (Entry entry : table) { while (entry != null) { values[idx++] = entry.key; entry = entry.next; } } return values; } LongHashSet(); @SuppressWarnings("unchecked")  LongHashSet(int capacity); static LongHashSet createSynchronized(); static LongHashSet createSynchronized(int capacity); boolean contains(long key); boolean add(long key); boolean remove(long key); long[] keys(); void clear(); int size(); void setCapacity(int newCapacity); void setLoadFactor(float loadFactor); void reserveRoom(int entryCount);  }