OrderedProperties { public OrderedProperties filter(Predicate<String> filter) { for (Iterator<Entry<String, String>> it = pairs.entrySet().iterator(); it.hasNext(); ) { if (filter.test(it.next().getKey())) { it.remove(); } } return this; }  OrderedProperties filter(Predicate<String> filter); OrderedProperties addMapPairs(Map<String, String> additionalPairs); OrderedProperties addIterablePairs(Iterable<? extends Map.Entry<String, ?>> iterable); OrderedProperties addStringPairs(String keyValuePairs); OrderedProperties addStringPairs(InputStream is); OrderedProperties addPair(String key, String value); String asPairs(); String asPairsWithComment(String comment); Map<String, String> asMap(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void filter() { OrderedProperties pairs = createTestKeyValues(); pairs.filter(k -> k.equalsIgnoreCase("second")); assertKeyOrder(pairs, "first", "third", "FOURTH"); }