I expected this code to display true
:
int[] array = {1, 2};
System.out.println(Arrays.asList(array).contains(1));
The Arrays.asList(array)
will result in a singleton list of an int[]
.
It works as you expect if you change int[]
to Integer[]
. Don't know if that helps you though.