@Test public void testKeys() { LongHashMap map = new LongHashMap(); map.put(0, "a"); map.put(-98, "b"); map.put(666, "c"); map.put(Long.MAX_VALUE, "d"); map.remove(666); long[] keys = map.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; }
LongHashMap { 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; } }
LongHashMap { 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; } LongHashMap(); @SuppressWarnings("unchecked")  LongHashMap(int capacity); }
LongHashMap { 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; } LongHashMap(); @SuppressWarnings("unchecked")  LongHashMap(int capacity); static LongHashMap<T> createSynchronized(); static LongHashMap<T> createSynchronized(int capacity); boolean containsKey(long key); T get(long key); T put(long key, T value); T remove(long key); long[] keys(); Entry<T>[] entries(); void clear(); int size(); void setCapacity(int newCapacity); void reserveRoom(int entryCount); }
LongHashMap { 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; } LongHashMap(); @SuppressWarnings("unchecked")  LongHashMap(int capacity); static LongHashMap<T> createSynchronized(); static LongHashMap<T> createSynchronized(int capacity); boolean containsKey(long key); T get(long key); T put(long key, T value); T remove(long key); long[] keys(); Entry<T>[] entries(); void clear(); int size(); void setCapacity(int newCapacity); void reserveRoom(int entryCount);  }