In Java 8, I am finding this a bit odd. I can't seem to create a byte stream out of a byte[]
array. The Array.stream
class seems to only work on int[]
, long[]
, double[]
, or T[]
.
public long update(final byte[] buffer) {
crc = 0L;
Arrays.stream(buffer).forEach(this::update); // expecting to go into a function update(byte b)
return crc;
}
When I try alternatives like Stream.of(buffer)
or Arrays.asList(buffer).stream().forEach(this::update);
the stream just reflects itself and I get a byte[]
.
Am I missing something in the implementation here?