@Test public void transformedMapTest() { TransformedMap<Integer, Integer, Integer> transformed_map = new TransformedMap<>(dataSet, trans); Assert.assertEquals(transformed_map.size(), dataSet.size()); for (Map.Entry<Integer, Integer> entry: transformed_map.entrySet()) { Assert.assertEquals(entry.getValue(), trans.transform( new Duo<>(entry.getKey(), dataSet.get(entry.getKey())) ) ); } Assert.assertTrue(transformed_map.keySet().containsAll(dataSet.keySet())); Assert.assertTrue(dataSet.keySet().containsAll(transformed_map.keySet())); }
public TransformedMap(Map<K,Vi> input, Transformer<Duo<K,Vi>,Vo> transformer) { Objects.requireNonNull(input, "input map must not be null"); Objects.requireNonNull(transformer, "transformer must not be null"); this.input = input; this.transformer = transformer; }
TransformedMap extends AbstractMap<K,Vo> { public TransformedMap(Map<K,Vi> input, Transformer<Duo<K,Vi>,Vo> transformer) { Objects.requireNonNull(input, "input map must not be null"); Objects.requireNonNull(transformer, "transformer must not be null"); this.input = input; this.transformer = transformer; } }
TransformedMap extends AbstractMap<K,Vo> { public TransformedMap(Map<K,Vi> input, Transformer<Duo<K,Vi>,Vo> transformer) { Objects.requireNonNull(input, "input map must not be null"); Objects.requireNonNull(transformer, "transformer must not be null"); this.input = input; this.transformer = transformer; } TransformedMap(Map<K,Vi> input, Transformer<Duo<K,Vi>,Vo> transformer); }
TransformedMap extends AbstractMap<K,Vo> { public TransformedMap(Map<K,Vi> input, Transformer<Duo<K,Vi>,Vo> transformer) { Objects.requireNonNull(input, "input map must not be null"); Objects.requireNonNull(transformer, "transformer must not be null"); this.input = input; this.transformer = transformer; } TransformedMap(Map<K,Vi> input, Transformer<Duo<K,Vi>,Vo> transformer); @Override Vo get(Object key); @Override Set<Entry<K,Vo>> entrySet(); }
TransformedMap extends AbstractMap<K,Vo> { public TransformedMap(Map<K,Vi> input, Transformer<Duo<K,Vi>,Vo> transformer) { Objects.requireNonNull(input, "input map must not be null"); Objects.requireNonNull(transformer, "transformer must not be null"); this.input = input; this.transformer = transformer; } TransformedMap(Map<K,Vi> input, Transformer<Duo<K,Vi>,Vo> transformer); @Override Vo get(Object key); @Override Set<Entry<K,Vo>> entrySet();  }