I could think of these things,
Arrays.asList(byte[])
converts byte[]
to List<byte[]>
,I was just wondering Is there any library function to do that?
Library Apache Commons Lang has ArrayUtils.toObject, which turns a primitive array to a typed object array:
int array[] = { 1, 2, 3 }; List<Integer> list = Arrays.asList(ArrayUtils.toObject(array));
As this post suggests: the guava Bytes class can help out:
byte[] bytes = ... List<Byte> byteList = Bytes.asList(bytes);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With