I am trying to convert an array of bytes to a LinkedList<Byte>
:
//data is of type byte[]
List<Byte> list = Arrays.stream(toObjects(data)).boxed().collect(Collectors.toList());
Byte[] toObjects(byte[] bytesPrim) {
Byte[] bytes = new Byte[bytesPrim.length];
Arrays.setAll(bytes, n -> bytesPrim[n]);
return bytes;
}
The first line raises an error message saying:
The method
boxed()
is undefined for the typeStream<Byte>
.
Any idea why am I getting this error message and how to circumvent this problem please?