I'm getting this odd error in my Java and I'm completely stuck.
private List<byte[]> sharedWorlds = Collections.synchronizedList(new ArrayList<byte[]>());
Byte[] y = sharedWorlds.toArray(new Byte[0]);
try{
//this line won't compile!
Utilities.writeByteArray(outStream, sharedWorlds.toArray(new Byte[0]));
}catch(Exception e){
System.out.println("Error!");
}
Type mismatch: cannot convert from Byte[] to byte[]
The second parameter to "writeByteArray" needs to be a byte[] and not a Byte[]...
I could loop through a new byte[] and copy every element, but this seems unclean and inefficient?
I tried casting
(byte[]) sharedWorlds.toArray(new Byte[0])
but this errors with
Cannot cast from Byte[] to byte[]
My Java is rusty, but I have no idea what's going on here.