Returns a map containing the mappings in
unfiltered whose keys
satisfy a predicate. The returned map is a live view of
unfiltered;
changes to one affect the other.
The resulting map's
keySet(),
entrySet(), and
values() views have iterators that don't support
remove(), but all
other methods are supported by the map and its views. When given a key that
doesn't satisfy the predicate, the map's
put() and
putAll()methods throw an
IllegalArgumentException.
When methods such as
removeAll() and
clear() are called
on the filtered map or its views, only mappings whose keys satisfy the
filter will be removed from the underlying map.
The returned map isn't threadsafe or serializable, even if
unfiltered is.
Many of the filtered map's methods, such as
size(),
iterate across every key/value mapping in the underlying map and determine
which satisfy the filter. When a live view is not needed, it may be
faster to copy the filtered map and use the copy.
Warning:
keyPredicate must be consistent with
equals, as documented at
Predicate#apply. Do not provide a
predicate such as
Predicates.instanceOf(ArrayList.class), which is
inconsistent with equals.