Takes some collections and creates a map from their elements to which collections contain them.
The Collections must be disjoint or an {@link java.lang.IllegalArgumentException} will be
thrown.
973914
public static <T, C extends Collection<T>> Map<T, C> makeElementsToContainersMap(
      final Iterable<C> collections) {
    final ImmutableMap.Builder<T, C> ret = ImmutableMap.builder();

    for (final C collection : collections) {
      for (final T item : collection) {
        ret.put(item, collection);
      }
    }

    return ret.build();
  }
307702
public static Collection map(Mapper mapper, Iterator i, boolean includeNull) {
        ArrayList l = new ArrayList();
        while (i.hasNext()) {
            Object o = mapper.map(i.next());
            if (includeNull || o != null) {
                l.add(o);
            }
        }
        return l;
    }
1251802
public static <T> List<T> toList(final Collection<T> collection) {

        if (isEmpty(collection)) {
            return new ArrayList<T>(0);
        } else {
            return new ArrayList<T>(collection);
        }
    }
373715
Collection<V> wrapCollection(@Nullable K key, Collection<V> collection) {
    // We don't deal with NavigableSet here yet for GWT reasons -- instead,
    // non-GWT TreeMultimap explicitly overrides this and uses NavigableSet.
    if (collection instanceof SortedSet) {
      return new WrappedSortedSet(key, (SortedSet<V>) collection, null);
    } else if (collection instanceof Set) {
      return new WrappedSet(key, (Set<V>) collection);
    } else if (collection instanceof List) {
      return wrapList(key, (List<V>) collection, null);
    } else {
      return new WrappedCollection(key, collection, null);
    }
  }
666582
public static <T> Collection<T> intersection(Collection<T> coll1, Collection<T> coll2) {
		final ArrayList<T> list = new ArrayList<>();
		if (isNotEmpty(coll1) && isNotEmpty(coll2)) {
			final Map<T, Integer> map1 = countMap(coll1);
			final Map<T, Integer> map2 = countMap(coll2);
			final Set<T> elts = newHashSet(coll2);
			int m;
			for (T t : elts) {
				m = Math.min(Convert.toInt(map1.get(t), 0), Convert.toInt(map2.get(t), 0));
				for (int i = 0; i < m; i++) {
					list.add(t);
				}
			}
		}
		return list;
	}
767643
@Pure
	public static Map<ShapeElementType, MapElementGroup> classifiesElements(Iterator<? extends MapElement> elements) {
		final Map<ShapeElementType, MapElementGroup> classification = new TreeMap<>();
		classifiesElements(classification, elements);
		return classification;
	}
995510
public static <K, V> Map<K, V> unmodifiableMap(final Map<? extends K, ? extends V> m) {
		return Collections.unmodifiableMap(m);
	}
991746
public static Collection map(Mapper mapper, Object o) {
        return java.util.Collections.singleton(mapper.map(o));
    }
338976
public static Collection<Attribute> fromMap(Map<String,Object> map) {
        requireNonNull(map);
        Collection<Attribute> attributes = new HashSet<>();
        convertObject(attributes, map, "", 0, new HashMap<>());
        return attributes;
    }
1366707
@SuppressWarnings("unchecked")
  protected void fromHierarchicalMap(Map<String, Object> map) {

    for (Entry<String, Object> entry : map.entrySet()) {
      SimpleConfigProperties child = (SimpleConfigProperties) getChild(entry.getKey(), true);
      Object childObject = entry.getValue();
      if (childObject instanceof Map) {
        child.fromHierarchicalMap((Map<String, Object>) childObject);
      } else {
        child.value = childObject.toString();
      }
    }
  }
507252
public static StringValueMap fromMaps(Map<?, ?>... maps) {
		StringValueMap result = new StringValueMap();
		if (maps != null && maps.length > 0) {
			for (Map<?, ?> map : maps)
				result.append(map);
		}
		return result;
	}
362824
public Collection<B> values() {
	return new AbstractCollection<B>() {
	    public int size() { return map.size(); }
	    public Iterator<B> iterator() {
		return 
		    DSUtil.<Map.Entry<A,B>,B>mapIterator
		    (BijMap.this.entrySet().iterator(),
		     new Function<Map.Entry<A,B>,B>() {
			public B f(Map.Entry<A,B> entry) {
			    return entry.getValue();
			}
		    });
	    }
	    public boolean remove(Object b) {
		return BijMap.this.rev().remove(b) != null;
	    }
	    public void clear() {
		BijMap.this.clear();
	    }
	};
    }
1183537
public Map<Object, Map<Object, String>> getElementCollectionCache()
    {
        if (this.elementCollectionCache == null)
        {
            this.elementCollectionCache = new HashMap<Object, Map<Object, String>>();
        }
        return this.elementCollectionCache;
    }
498672
public static <K, V> List<V> getIfPresentForEach(final Map<K, V> map, final Collection<?> keys) {
        if (N.isNullOrEmpty(map) || N.isNullOrEmpty(keys)) {
            return new ArrayList<>(0);
        }

        final List<V> result = new ArrayList<>(keys.size());
        V val = null;

        for (Object key : keys) {
            val = map.get(key);

            if (val != null || map.containsKey(key)) {
                result.add(val);
            }
        }

        return result;
    }
187043
protected static final Collection<?> objectToCollection(Object object) {
		Collection<?> collection = null;
		if (object != null) {
			if (object instanceof Collection) {
				collection = (Collection<?>) object;
			} else if (object instanceof Map) {
				collection = ((Map<?, ?>) object).values();
			} else if (object.getClass().isArray()) {
				LinkedList<Object> list = new LinkedList<Object>();
				int len = Array.getLength(object);
				for (int i = 0; i < len; i++) {
					list.addLast(Array.get(object, i));
				}
				collection = list;
			} else {
				collection = Collections.singleton(object);
			}
		}
		return collection;
	}
1126632
public static <V> Map<V, V> convertListToMap(List<V> list) {
        Map<V, V> map = new HashMap<V, V>();
        if(list.size() % 2 != 0)
            throw new VoldemortException("Failed to convert list to map.");
        for(int i = 0; i < list.size(); i += 2) {
            map.put(list.get(i), list.get(i + 1));
        }
        return map;
    }
1241535
public static <K, V> Map<K, V> putAll(Map<K, V> self, Collection<? extends Map.Entry<? extends K, ? extends V>> entries) {
        for (Map.Entry<? extends K, ? extends V> entry : entries) {
            self.put(entry.getKey(), entry.getValue());
        }
        return self;
    }