Creates new aggregating maps.

@param map1
@param map2
@param <K>
@param <V>
@return
193449
public static <K, V> Map<K, V> aggregate(Map<K, V> map1, Map<K, V> map2) {
        return new AggregatingMap<K, V>(map1, map2);
    }
1126111
public static <K, V> TreeMap<K, V> treeMapOf(K k1, V v1, K k2, V v2) {
    TreeMap<K, V> treeMap = new TreeMap<>();
    treeMap.put(k1, v1);
    treeMap.put(k2, v2);
    return treeMap;
  }
856466
private static <K, V> List<V> aggregateCacheValues(Map<K, CacheValue<V>> map) {
    List<V> values = new ArrayList<>(map.size());
    for (Map.Entry<K, CacheValue<V>> entry : map.entrySet()) {
      values.add(entry.getValue().getValue());
    }
    return values;
  }
345937
public static <K, NEW, OLD> Map<K, NEW> convert(Map<K, OLD> map, Function<OLD, NEW> function) {
        Map<K, NEW> newMap = new HashMap<>();
        map.forEach((k, v) -> newMap.put(k, function.apply(v)));
        return newMap;
    }
204220
public static <K, V> Map<K, V> filter(Map<K, V> map, Filter<Entry<K, V>> filter) {
		if(null == map || null == filter) {
			return map;
		}
		
		final Map<K, V> map2 = ObjectUtil.clone(map);
		if (isEmpty(map2)) {
			return map2;
		}

		map2.clear();
		for (Entry<K, V> entry : map.entrySet()) {
			if (filter.accept(entry)) {
				map2.put(entry.getKey(), entry.getValue());
			}
		}
		return map2;
	}
388668
static <T> Map<T, AggregationData> createAggregationMap(
      Map<T, MutableAggregation> tagValueAggregationMap, Measure measure) {
    Map<T, AggregationData> map = Maps.newHashMap();
    for (Entry<T, MutableAggregation> entry : tagValueAggregationMap.entrySet()) {
      map.put(entry.getKey(), entry.getValue().toAggregationData());
    }
    return map;
  }
412429
public static <K, V> Map<K, V> newMap(Map<K, V> map) {
        return Optional.ofNullable(map).map(HashMap::new)
                .orElseGet(HashMap::new);
    }
1102502
public static <K, V extends Comparable<V>> Map<K, V>
    sortByValue(Map<K, V> map) {
        return sort(map, comparing(map::get));
    }
1240360
public static <K extends Comparable<K>, V> Map<K, V> sort(Map<K, V> map) {
        return new TreeMap<>(map);
    }
1217024
public static <K extends Comparable, V extends Comparable> TreeMultimap<K, V> create(
      Multimap<? extends K, ? extends V> multimap) {
    return new TreeMultimap<K, V>(Ordering.natural(), Ordering.natural(), multimap);
  }
38254
static public <K,V> Map<K,V> map(Map<?,?> map)
	{
		return (Map<K,V>)map;
	}
512916
@SuppressWarnings("unchecked")
    public static <K extends Object, V extends Object> Map<K, V> createMap(
            Object... keysAndValues) {
        if (keysAndValues == null) {
            return null;
        }
        if (keysAndValues.length % 2 != 0) {
            throw new IllegalArgumentException("Number of arguments must be even!");
        }
        Map<K, V> result = new LinkedHashMap<>();
        for (int i = 0, n = keysAndValues.length / 2; i < n; i++) {
            result.put((K) keysAndValues[i * 2], (V) keysAndValues[i * 2 + 1]);
        }
        return result;
    }
991003
@Override
	public <NK, NV> FMap<NK, NV> map(BiFunction<? super K, ? super V, Product2<? extends NK, ? extends NV>> f) {
		HashFMap<NK, NV> ret = new HashFMap<>(new HashMap<>(this.size()));
		for (java.util.Map.Entry<K, V> entry : entrySet()) {
			Product2<? extends NK,? extends NV> t = f.apply(entry.getKey(), entry.getValue());
			ret.put(t.get1(), t.get2());
		}
		return ret;
	}
478616
public static <K, V> Map<K, V> newHashMap(Object... args) {
        Map<K, V> m = new HashMap<K, V>();
        for (int i = 0; i < args.length; i += 2) {
            m.put((K) args[i], i + 1 >= args.length ? null : (V) args[i + 1]);
        }
        return m;
    }
1030529
public static <T> Collection<T> union(Collection<T> coll1, Collection<T> coll2) {
		final ArrayList<T> list = new ArrayList<>();
		if (isEmpty(coll1)) {
			list.addAll(coll2);
		} else if (isEmpty(coll2)) {
			list.addAll(coll1);
		} else {
			final Map<T, Integer> map1 = countMap(coll1);
			final Map<T, Integer> map2 = countMap(coll2);
			final Set<T> elts = newHashSet(coll2);
			elts.addAll(coll1);
			int m;
			for (T t : elts) {
				m = Math.max(Convert.toInt(map1.get(t), 0), Convert.toInt(map2.get(t), 0));
				for (int i = 0; i < m; i++) {
					list.add(t);
				}
			}
		}
		return list;
	}
1287570
public static <K, E> void addToList(Map<K, List<E>> map, K k, E e)
    {
        getList(map, k).add(e);
    }
115058
public static <K, V> void putIntoListMap(K key, V value, Map<? super K, List<V>> map) {
		List<V> list = map.get(key);
		if (list == null) {
			list = Lists.newArrayListWithCapacity(2);
			map.put(key, list);
		}
		list.add(value);
	}