@Test public void entrySet() { final Set<Map.Entry<String, ConfigValue>> entries = sampleMap().entrySet(); assertEquals(2, entries.size()); assertTrue(entries.contains(new AbstractMap.SimpleImmutableEntry<>("my.prop", toConfigValue("my.prop", "1234")))); assertTrue(entries.contains(new AbstractMap.SimpleImmutableEntry<>("my.null", (ConfigValue) null))); assertThrows(UnsupportedOperationException.class, () -> entries.remove( new AbstractMap.SimpleImmutableEntry<>("my.prop", toConfigValue("my.prop", "1234")))); }
@Override public Set<Map.Entry<String, ConfigValue>> entrySet() { if (entrySet == null) { entrySet = new AbstractSet<Entry<String, ConfigValue>>() { @Override public Iterator<Entry<String, ConfigValue>> iterator() { return new Iterator<Entry<String, ConfigValue>>() { final Iterator<Entry<String, String>> delegate = ConfigValueMapStringView.this.delegate.entrySet() .iterator(); @Override public boolean hasNext() { return delegate.hasNext(); } @Override public Entry<String, ConfigValue> next() { final Entry<String, String> next = delegate.next(); final String value = next.getValue(); return value != null ? new SimpleImmutableEntry<>(next.getKey(), toConfigValue(next.getKey(), value)) : new SimpleImmutableEntry<>(next.getKey(), null); } }; } @Override public int size() { return delegate.size(); } }; } return entrySet; }
ConfigValueMapStringView extends AbstractMap<String, ConfigValue> { @Override public Set<Map.Entry<String, ConfigValue>> entrySet() { if (entrySet == null) { entrySet = new AbstractSet<Entry<String, ConfigValue>>() { @Override public Iterator<Entry<String, ConfigValue>> iterator() { return new Iterator<Entry<String, ConfigValue>>() { final Iterator<Entry<String, String>> delegate = ConfigValueMapStringView.this.delegate.entrySet() .iterator(); @Override public boolean hasNext() { return delegate.hasNext(); } @Override public Entry<String, ConfigValue> next() { final Entry<String, String> next = delegate.next(); final String value = next.getValue(); return value != null ? new SimpleImmutableEntry<>(next.getKey(), toConfigValue(next.getKey(), value)) : new SimpleImmutableEntry<>(next.getKey(), null); } }; } @Override public int size() { return delegate.size(); } }; } return entrySet; } }
ConfigValueMapStringView extends AbstractMap<String, ConfigValue> { @Override public Set<Map.Entry<String, ConfigValue>> entrySet() { if (entrySet == null) { entrySet = new AbstractSet<Entry<String, ConfigValue>>() { @Override public Iterator<Entry<String, ConfigValue>> iterator() { return new Iterator<Entry<String, ConfigValue>>() { final Iterator<Entry<String, String>> delegate = ConfigValueMapStringView.this.delegate.entrySet() .iterator(); @Override public boolean hasNext() { return delegate.hasNext(); } @Override public Entry<String, ConfigValue> next() { final Entry<String, String> next = delegate.next(); final String value = next.getValue(); return value != null ? new SimpleImmutableEntry<>(next.getKey(), toConfigValue(next.getKey(), value)) : new SimpleImmutableEntry<>(next.getKey(), null); } }; } @Override public int size() { return delegate.size(); } }; } return entrySet; } ConfigValueMapStringView(final Map<String, String> delegate, final String configSourceName,
            final int configSourceOrdinal); }
ConfigValueMapStringView extends AbstractMap<String, ConfigValue> { @Override public Set<Map.Entry<String, ConfigValue>> entrySet() { if (entrySet == null) { entrySet = new AbstractSet<Entry<String, ConfigValue>>() { @Override public Iterator<Entry<String, ConfigValue>> iterator() { return new Iterator<Entry<String, ConfigValue>>() { final Iterator<Entry<String, String>> delegate = ConfigValueMapStringView.this.delegate.entrySet() .iterator(); @Override public boolean hasNext() { return delegate.hasNext(); } @Override public Entry<String, ConfigValue> next() { final Entry<String, String> next = delegate.next(); final String value = next.getValue(); return value != null ? new SimpleImmutableEntry<>(next.getKey(), toConfigValue(next.getKey(), value)) : new SimpleImmutableEntry<>(next.getKey(), null); } }; } @Override public int size() { return delegate.size(); } }; } return entrySet; } ConfigValueMapStringView(final Map<String, String> delegate, final String configSourceName,
            final int configSourceOrdinal); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(final Object key); @Override boolean containsValue(final Object value); @Override ConfigValue get(final Object key); @Override Set<String> keySet(); @Override Set<Map.Entry<String, ConfigValue>> entrySet(); @Override Collection<ConfigValue> values(); }
ConfigValueMapStringView extends AbstractMap<String, ConfigValue> { @Override public Set<Map.Entry<String, ConfigValue>> entrySet() { if (entrySet == null) { entrySet = new AbstractSet<Entry<String, ConfigValue>>() { @Override public Iterator<Entry<String, ConfigValue>> iterator() { return new Iterator<Entry<String, ConfigValue>>() { final Iterator<Entry<String, String>> delegate = ConfigValueMapStringView.this.delegate.entrySet() .iterator(); @Override public boolean hasNext() { return delegate.hasNext(); } @Override public Entry<String, ConfigValue> next() { final Entry<String, String> next = delegate.next(); final String value = next.getValue(); return value != null ? new SimpleImmutableEntry<>(next.getKey(), toConfigValue(next.getKey(), value)) : new SimpleImmutableEntry<>(next.getKey(), null); } }; } @Override public int size() { return delegate.size(); } }; } return entrySet; } ConfigValueMapStringView(final Map<String, String> delegate, final String configSourceName,
            final int configSourceOrdinal); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(final Object key); @Override boolean containsValue(final Object value); @Override ConfigValue get(final Object key); @Override Set<String> keySet(); @Override Set<Map.Entry<String, ConfigValue>> entrySet(); @Override Collection<ConfigValue> values();  }