I passed the array declared with int [] to Arrays.asList and contained it, but it didn't work as expected.
int[] array = {1, 2, 3, 4, 5};
Arrays.asList(array).contains(3)
-> false
I searched for various things, but I thought that I would declare the array with Integer [] instead of int [].
Integer[] array = {1, 2, 3, 4, 5};
Arrays.asList(array).contains(3)
-> true
Recommended Posts