DoubleMapGenotype extends DoubleGenotype implements MapGenotype<K, Double> { @Override public boolean containsKey(K key) { return keys.contains(key); } DoubleMapGenotype(List<K> keys, Bounds<Double> bounds); void init(Random random); @Override void init(Random random, int n); @Override boolean containsKey(K key); @Override Double getValue(K key); @Override void setValue(K key, Double value); @Override @SuppressWarnings({ "unchecked", "rawtypes" }) G newInstance(); @Override String toString(); @Override int getIndexOf(K key); @Override Collection<K> getKeys();  }
@Test() public void testContainsKey() { List<MockObject> keys = new ArrayList<>(); MockObject m1 = new MockObject(1); MockObject m2 = new MockObject(2); MockObject m3 = new MockObject(3); keys.add(m1); keys.add(m2); DoubleMapGenotype<MockObject> doubleMapGeno = new DoubleMapGenotype<>(keys, new MockBounds()); assertTrue(doubleMapGeno.containsKey(m1)); assertFalse(doubleMapGeno.containsKey(m3)); }