I am unable to understand why the following does not work ?
boolean[] a = new boolean[5];
Arrays.stream(a);
I keep getting the error :
I tried using the generic parameter:
Arrays.<Boolean>stream(a);
I can’t seem to figure it out.
What am I completely missing ?
I am using OpenJDK 11.
>Solution :
There is support for primitives int, long and double. The idea is that char, byte and short can be handled by int, float by double, and boolean by Boolean. The only main issue there is the conversion of array to stream.
This can be solved using a simple workaround:
Stream<Boolean> boolStream = IntStream.range(0, array.length)
.mapToObj(i -> array[i]);
