MCPcopy Create free account
hub / github.com/apache/storm / multiset

Method multiset

storm-server/src/main/java/org/apache/storm/Testing.java:592–603  ·  view source on GitHub ↗

Count how many times each element appears in the Collection. @param c a collection of values @return a map of the unique values in c to the count of those values.

(Collection<T> c)

Source from the content-addressed store, hash-verified

590 * @return a map of the unique values in c to the count of those values.
591 */
592 public static <T> Map<T, Integer> multiset(Collection<T> c) {
593 Map<T, Integer> ret = new HashMap<T, Integer>();
594 for (T t : c) {
595 Integer i = ret.get(t);
596 if (i == null) {
597 i = new Integer(0);
598 }
599 i += 1;
600 ret.put(t, i);
601 }
602 return ret;
603 }
604
605 private static void printRec(Object o, String prefix) {
606 if (o instanceof Collection) {

Callers 1

multiseteqMethod · 0.95

Calls 2

getMethod · 0.65
putMethod · 0.65

Tested by

no test coverage detected