How to add byte [] to the <Byte> list?

How to add items byte[]to List<Byte>?

+3
source share
2 answers

Using Guava , you can use Bytes.asList (bytes ...) as follows:

List<Byte> list = ...
byte[] bytes = ...
list.addAll(Bytes.asList(bytes));
+5
source

Is this what you are looking for?

for(byte b : byte) {
    list.add(b);
}
+8
source

Source: https://habr.com/ru/post/1789039/


All Articles