Slice implements Iterable<Value> { public void set(Attribute field, Value value) { values.put(field, value); } Slice(Value defaultValue); Value get(Attribute field); void set(Attribute field, Value value); @Override Iterator<Value> iterator();  }
@Test public void shouldGetPopulatedValuesWhenIterating() { Slice<String, String> slice = new Slice<>("default"); slice.set("foo", "bar"); slice.set("bar", "foo"); List<String> all = StreamSupport.stream(slice.spliterator(), false).collect(Collectors.toList()); assertEquals(2, all.size()); assertTrue(all.contains("foo")); assertTrue(all.contains("bar")); }