I expect that this code prints "0" since the starting size of the array is 0, but what it does is printing "1". Can someone explain me why, using Arrays.asList on an empty collection alter the size of the resulting collection? I know that "asList" gives back a fixed-size array but still I cannot imagine what's the reason behind that.
@Test
public void checkEmptinessTest() {
byte[] arrayOfTest = new byte[0];
System.out.println(Arrays.asList(arrayOfTest).size());
}
I tried to initialize the array with no items like this:
byte[] arrayOfTest = new byte[] = {};
but the result is the same. Thanks for the help.