I recently used Arrays.asList() and found that if its parameter is a basic type array, this is the error message;
Multiple markers at this line
- The method addAll(Collection<? extends Byte>) in the type ArrayList<Byte> is not applicable for the arguments
(List<byte[]>)
In other words, it treats the basic type array as a List<type[]>, that is, as a whole object.
Another modification method is to change byte[] to Byte[], so that it can run normally. In other words, the parameter received by asList() should be an object array;
If the parameter is an array of basic types, it will be treated as an object array with only one element (that is, the element is an array of basic types).
As simple as it comes. java autoboxing.
Latest addition
I recently used
Arrays.asList()
and found that if its parameter is a basic type array, this is the error message;In other words, it treats the basic type array as a
List<type[]>
, that is, as a whole object.Another modification method is to change
byte[]
toByte[]
, so that it can run normally. In other words, the parameter received byasList()
should be an object array;If the parameter is an array of basic types, it will be treated as an object array with only one element (that is, the element is an array of basic types).