code: public static <K, V> Function<K, V> forMap (final Map<K, ? extends V> map, final V defaultValue)
      {
          return new Function<K, V>() {
              public V apply (K key) {
                  V value = map.get(key);
                  return (value != null || map.containsKey(key)) ? value : defaultValue;
              }
          };
      }
docs: Returns a function which performs a map lookup with a default value. The function created by
  this method returns defaultValue for all inputs that do not belong to the map's key set.