mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8067969: Optimize Stream.count for SIZED Streams
Reviewed-by: psandoz, chegar
This commit is contained in:
parent
2349ff99bc
commit
cb566c6ce5
11 changed files with 368 additions and 31 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue