@Override public Set<Map.Entry<String, Object>> entrySet() { return properties.entrySet(); }
/** * Removes all properties with names that are not in the provided set. * * @param propertiesToKeep a set of properties to keep */ public void keepOnly(final Collection<String> propertiesToKeep) { entrySet().removeIf(entry -> !propertiesToKeep.contains(entry.getKey())); }
public void copyProperties(final Properties properties) { if (null != properties) { for (final Entry<String, Object> entry : properties.entrySet()) { putProperty(entry.getKey(), entry.getValue()); } } }
@Test public void shouldDelegateEntrySetMethodToPropertiesInstance() { // Given final Properties properties = mock(Properties.class); final LazyProperties lazyProperties = new LazyProperties(properties, null); final Set<Map.Entry<String, Object>> expectedEntrySet = mock(Set.class); given(properties.entrySet()).willReturn(expectedEntrySet); // When final Set<Map.Entry<String, Object>> entrySet = lazyProperties.entrySet(); // Then assertSame(expectedEntrySet, entrySet); } }
@Override public Set<Map.Entry<String, Object>> entrySet() { return properties.entrySet(); }
/** * Removes all properties with names that are not in the provided set. * * @param propertiesToKeep a set of properties to keep */ public void keepOnly(final Collection<String> propertiesToKeep) { entrySet().removeIf(entry -> !propertiesToKeep.contains(entry.getKey())); }
public void copyProperties(final Properties properties) { if (null != properties) { for (final Entry<String, Object> entry : properties.entrySet()) { putProperty(entry.getKey(), entry.getValue()); } } }