The filterKeys method of the Maps class in the Guava library allows you to create a new map that contains only the entries whose keys satisfy a given predicate. This method returns a view of the original map, so any changes made to this view will be reflected in the original map, and vice versa.
Example 1: In this example, we create a map of colors and their corresponding hexadecimal values. We use the filterKeys method to create a new map that contains only the entries for colors whose names start with the letter "b".
// filteredScores contains only the entry for "Bob"
Package/Library: com.google.common.collect.
Java Maps.filterKeys - 22 examples found. These are the top rated real world Java examples of com.google.common.collect.Maps.filterKeys extracted from open source projects. You can rate examples to help us improve the quality of examples.