[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-lambda-libs-spec
Subject: Some small issues with the stream library
From: Kasper Nielsen <kasperni () gmail ! com>
Date: 2014-04-17 13:13:51
Message-ID: CAPs6153hiDvKZT7uJOs_PNj8Onb_th5U6rg+Niff0HJjQh3RPw () mail ! gmail ! com
[Download RAW message or body]
Hi,
I'm trying to build a small test suite for for a custom stream
implementation I'm making.
And I found a couple of small issues with java.util.stream.Stream. Nothing
major but might be worth fixing
1)
There are couple of places where null checks are missing
*Stream.close
Int/Double/LongStream.flatmap
Int/Double/LongStream.collect(x,y, 3rd) 3rd argument not being checked
2)
These methods does throw NPE but they consume the stream before throwing.
I like to think of null parameter checks as side-effect free.
Stream.forEach
Stream.forEachOrdered
Stream.sorted
Stream.toArray
3)
LongStream.Average does not always work as intended with high long values
Arrays.*asList*(Long.*MAX_VALUE* - 1000L, Long.*MAX_VALUE* -
1000L).stream().mapToLong(e -> e).average().getAsDouble; return -1001.0
Same thing with SummaryStatistics
Cheers
Kasper
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic