Simply, I'm trying to iterate over an array using a stream to find out if every element is the same type of object. I have figured out two ways of doing this (foo
is a byte array byte[]
).
Arrays.asList(foo).parallelStream().allMatch(aByte -> aByte == Byte.MIN_VALUE);
and
Stream.of(foo).parallel().allMatch(aByte -> aByte == Byte.MIN_VALUE);
However, I keep getting the error "Incompatible operand types byte[] and byte"
. So that means that aByte
is of type byte[]
. Why is that? Why is it not just a normal byte
? And how may I correct this problem?