-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
9, 10
-
b56
-
generic
-
generic
FULL PRODUCT VERSION :
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux juan-notebook 4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
When I execute the following sentence:
jshell> Stream.of("A","B","C").peek(System.out::println).count()
I get the result:
$9 ==> 3
But should be:
A
B
C
3
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Open jshell and execute:
Stream.of("A","B","C").peek(System.out::println).count()
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A
B
C
3
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Don't use it with jshell.
When I execute the following class works ok:
class Snippet {
public static void main(String[] args) {
System.out.println(java.util.stream.Stream.of("lower", "case", "text")
.peek(System.out::println)
.count());
}
}
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux juan-notebook 4.13.0-32-generic #35-Ubuntu SMP Thu Jan 25 09:13:46 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
When I execute the following sentence:
jshell> Stream.of("A","B","C").peek(System.out::println).count()
I get the result:
$9 ==> 3
But should be:
A
B
C
3
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Open jshell and execute:
Stream.of("A","B","C").peek(System.out::println).count()
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A
B
C
3
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Don't use it with jshell.
When I execute the following class works ok:
class Snippet {
public static void main(String[] args) {
System.out.println(java.util.stream.Stream.of("lower", "case", "text")
.peek(System.out::println)
.count());
}
}
- relates to
-
JDK-8067969 Optimize Stream.count for SIZED Streams
- Closed