8067969: Optimize Stream.count for SIZED Streams

Reviewed-by: psandoz, chegar
This commit is contained in:
Aggelos Biboudis 2015-03-16 10:19:49 +01:00 committed by Paul Sandoz
parent 2349ff99bc
commit cb566c6ce5
11 changed files with 368 additions and 31 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -523,10 +523,9 @@ abstract class ReferencePipeline<P_IN, P_OUT>
@Override
public final long count() {
return mapToLong(e -> 1L).sum();
return evaluate(ReduceOps.makeRefCounting());
}
//
/**