code: public static <K, V> List<V> removeAllIfByKey(Map<K, V> map,
              Predicate<? super K> filter) {
          return map.keySet().stream().filter(filter).collect(toList())
                  .stream().map(map::remove).collect(toList());
      }
docs: Remove all if by key list.
  
  @param <K>    the type parameter
  @param <V>    the type parameter
  @param map    the map
  @param filter the filter
  @return the list