Returns a functional wrapper for the input map, providing a way to apply
a function on all its entries in a functional style.

@param map
the map to which the functor will be applied.
@return
a map that also extends this abstract class.
346921
public static final <S, K, V> Functional<S> functionalMap(Map<K, V> map) {
		return new FunctionalMap<S, K, V>(map);
	}
294147
public static <K, E> Set<E> getAndPutSetIfAbsent(final Map<K, Set<E>> map, final K key) {
        Set<E> v = map.get(key);

        if (v == null) {
            v = new HashSet<>();
            v = map.put(key, v);
        }

        return v;
    }
1131849
public static ValueMap map(Object... map) {
        if (map.length / 2 * 2 != map.length)
            throw new IllegalArgumentException("Arguments should be <String> key - <?> value pairs");

        Builder builder = new Builder();
        for (int i = 0; i < map.length; i += 2)
            builder.put((String)map[i], map[i + 1]);

        return builder.build();
    }
1056334
@Provides
  @Singleton
  ImmutableMap<String, ? extends SoyFunction> provideSoyFunctionsMap(
      Set<SoyFunction> soyFunctionsSet) {
    Map<String, SoyFunction> mapBuilder = new LinkedHashMap<>();
    for (SoyFunction function : soyFunctionsSet) {
      SoyFunction old = mapBuilder.put(function.getName(), function);
      if (old != null && !old.getClass().getName().equals(function.getClass().getName())) {
        throw new IllegalStateException(
            "Found two functions with the same name: '"
                + function.getName()
                + "' and different implementations: "
                + function
                + " vs "
                + old);
      }
    }
    return ImmutableMap.copyOf(mapBuilder);
  }
127692
@NonNull
  public static <K, V> Map<K, V> immutableCopyOf(@NonNull Map<K, V> map) {
    return Collections.unmodifiableMap(new LinkedHashMap<>(map));
  }
986668
public static <K1, V1, K2, V2> MutableMap<K2, V2> collect(
            Map<K1, V1> map,
            final Function<? super K1, ? extends K2> keyFunction,
            final Function<? super V1, ? extends V2> valueFunction,
            Map<K2, V2> target)
    {
        return MapIterate.collect(map, new Function2<K1, V1, Pair<K2, V2>>()
        {
            public Pair<K2, V2> value(K1 key, V1 value)
            {
                return Tuples.pair(keyFunction.valueOf(key), valueFunction.valueOf(value));
            }
        }, MapAdapter.adapt(target));
    }
478235
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;
            }
        };
    }
45874
public M put(Map<String, Object> map) {
		attrs.putAll(map);
		return (M)this;
	}
1587
public static MapOperator with(final Map map, final Class<? extends Map> nodeClass) {
        return new MapOperator(map, nodeClass);
    }
76972
public MapBuilder<K, V> putAll(Map<K, V> map) {
		this.map.putAll(map);
		return this;
	}
1266754
public V get(Map<?, V> map){
		for (Object k : keys){
			V v = map.get(k);
			if (v != null){
				return v;
			}
		}
		return null;
	}
473414
public static <K, V> MutableMap<V, K> reverseMapping(Map<K, V> map)
    {
        final MutableMap<V, K> reverseMap = UnifiedMap.newMap(map.size());
        MapIterate.forEachKeyValue(map, new Procedure2<K, V>()
        {
            public void value(K sourceKey, V sourceValue)
            {
                reverseMap.put(sourceValue, sourceKey);
            }
        });
        return reverseMap;
    }
793798
public static <K, V> ImmutableMap<K, V> copyOf(Map<? extends K, ? extends V> map) {
    return new ImmutableMap<>(map);
  }
845380
public static Mapper mapMapper(final Map map) {
        return new Mapper() {
            public Object map(final Object a) {
                return map.get(a);
            }
        };
    }
1209411
public static <K, V> Map<K, V> toImmutableMap(final Map<K, V> map) {
    switch (map.size()) {
      case 0:
        return Collections.emptyMap();
      case 1:
        final Entry<K, V> entry = map.entrySet().iterator().next();
        return Collections.singletonMap(entry.getKey(), entry.getValue());
      default:
        return Collections.unmodifiableMap(map);
    }
  }
454924
public void append(Map<?, ?> map) {
		if (map == null || map.size() == 0)
			return;

		for (Map.Entry<?, ?> entry : map.entrySet()) {
			put(StringConverter.toString(entry.getKey()), StringConverter.toNullableString(entry.getValue()));
		}
	}
646937
public static <K, V, K2, V2> MutableMap<K2, V2> collect(
            Map<K, V> map,
            Function2<? super K, ? super V, Pair<K2, V2>> function)
    {
        return MapIterate.collect(map, function, UnifiedMap.<K2, V2>newMap(map.size()));
    }