OpenIntToDoubleHashMap implements Serializable { public double get(final int key) { final int hash = hashOf(key); int index = hash & mask; if (containsKey(key, index)) { return values[index]; } if (states[index] == FREE) { return missingEntries; } int j = index; for (int perturb = perturb(hash); states[index] != FREE; perturb >>= PERTURB_SHIFT) { j = probe(perturb, j); index = j & mask; if (containsKey(key, index)) { return values[index]; } } return missingEntries; } OpenIntToDoubleHashMap();  OpenIntToDoubleHashMap(final double missingEntries);  OpenIntToDoubleHashMap(final int expectedSize);  OpenIntToDoubleHashMap(final int expectedSize,
                                  final double missingEntries);  OpenIntToDoubleHashMap(final OpenIntToDoubleHashMap source); double get(final int key); boolean containsKey(final int key); Iterator iterator(); int size(); double remove(final int key); double put(final int key, final double value);  }
@Test public void testGetAbsent() { Map<Integer, Double> generated = generateAbsent(); OpenIntToDoubleHashMap map = createFromJavaMap(); for (Map.Entry<Integer, Double> mapEntry : generated.entrySet()) Assert.assertTrue(Double.isNaN(map.get(mapEntry.getKey()))); }
@Test public void testGetFromEmpty() { OpenIntToDoubleHashMap map = new OpenIntToDoubleHashMap(); Assert.assertTrue(Double.isNaN(map.get(5))); Assert.assertTrue(Double.isNaN(map.get(0))); Assert.assertTrue(Double.isNaN(map.get(50))); }