IntIntMap { public int[] keySet() { int[] result = new int[_map.size()]; int index = 0; for (int k : _map.keySet()) { result[index++] = k; } return result; } IntIntMap();  IntIntMap(IntIntMap source);  IntIntMap(int initialCapacity); int size(); int sum(); int[] keySet(); boolean contains(int key); void put(int key, int value); void add(int key, int value); int getValue(int key); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testKeySet() { IntIntMap map = new IntIntMap(); final int numEntries = 100; for (int i = 0; i < numEntries; i++) { int value = (i + 1) * 100; map.add(i, value); } int[] keys = map.keySet(); Arrays.sort(keys); for (int i = 0; i < numEntries; i++) { assertEquals(i, keys[i]); } }