changeset 6344:f5f46449a65e

Eliminate null check on hot path of groupBy Contributed-By: paul.sandoz@oracle.com
author briangoetz
date Wed, 24 Oct 2012 11:26:38 -0400
parents f0ca8e57004a
children d297a36079ce
files src/share/classes/java/util/streams/ops/GroupByOp.java
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/streams/ops/GroupByOp.java	Mon Oct 22 14:11:06 2012 -0700
+++ b/src/share/classes/java/util/streams/ops/GroupByOp.java	Wed Oct 24 11:26:38 2012 -0400
@@ -77,8 +77,7 @@
             Sink<S> sinkChain = helper.wrapSink(new Sink.OfValue<T>() {
                 @Override
                 public void accept(T t) {
-                    K key = Objects.requireNonNull(mapper.map(t), String.format("The element %s cannot be mapped to a null key", t));
-                    final Collection<T> sb = map.computeIfAbsent(key, (k) -> valueFactory.make());
+                    final Collection<T> sb = map.computeIfAbsent(mapper.map(t), (k) -> valueFactory.make());
                     synchronized (sb) {
                         sb.add(t);
                     }