MCPcopy Create free account
hub / github.com/BruceEckel/OnJava8-Examples / add

Method add

patterns/TypeMap.java:13–17  ·  view source on GitHub ↗
(T o)

Source from the content-addressed store, hash-verified

11 public final Map<Class, List<T>> map =
12 new HashMap<>();
13 public void add(T o) {
14 Class type = o.getClass();
15 map.computeIfAbsent(type,
16 k -> new ArrayList<T>()).add(o);
17 }
18 public Stream<List<T>> values() {
19 return map.values().stream();
20 }

Callers 2

BoxesMethod · 0.45
mainMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected