undefined behavior - Java list.contains returning false, should be true -
this question has answer here:
- arrays.aslist() not working should? 8 answers
okay, trying conditional checks , noticed returned false.... i'm missing?
int test = 1; int[] testing= {1,3}; system.out.println(arrays.aslist(testing).contains(test) ); //false???
arrays.aslist generic method generic type variable used in vararg parameter. primitive types don't work generics.
therefore, after
arrays.aslist(testing) the list returned contains single element, array of type int.
your test pass if testing declared integer[].
Comments
Post a Comment