Class MiscUtils
java.lang.Object
org.codehaus.mojo.versions.utils.MiscUtils
Miscellaneous utility class.
-
Method Summary
-
Method Details
-
filter
Filters a given map leaving only elements fulfilling a predicate. Does not change the input map, the filtered map is returned as output.- Type Parameters:
K- key typeV- value type- Parameters:
map- input map to be filteredpredicate- predicate for element comparison- Returns:
- map such that every element comforms with the predicate
-
filter
public static <K,V> Map<K,V> filter(Map<K, V> map, Function<V, Boolean> predicate, BinaryOperator<V> mergeFunction) Filters a given map leaving only elements fulfilling a predicate. Does not change the input map, the filtered map is returned as output.- Type Parameters:
K- key typeV- value type- Parameters:
map- input map to be filteredpredicate- predicate for element comparisonmergeFunction- function to resolve collisions between values associated with the same key- Returns:
- map such that every element comforms with the predicate
-