public class Main {
public static void main(String[] args) {
byte[] a=new byte[3];
List<Byte> c=new ArrayList<Byte>();
c.addAll(Arrays.asList(a));
//The method addAll(Collection<? extends Byte>) in the type List<Byte>
//is not applicable for the arguments (List<byte[]>)
Collections.addAll(c, a);
//The method addAll(Collection<? super T>, T...) in the type Collections
//is not applicable for the arguments (List<Byte>, byte[])
}
}
Last two lines give compile error.
To fix it, firstly I read this Create ArrayList from array discussing. I try this solution, but it don't work. Here Converting array to list in Java is explain, why it don't work, but isn't solution.
"source array is a primitive array of bytes, instead of Byte objects" is true, and I hope, that exists more beautibul solution, then iterate and cast each element.
Byte[]? There are very many threads here that discusses different workarounds and solutions.