I’m debugging my code and it looks like the built-in function contains does not work properly in my case. Look:
List<Integer[]> allVariables = new ArrayList<Integer[]>();
Integer[] cols = {1};
The List contains values:
[0] = Integer[1] => {1}
[1] = Integer[4] => {1,2,3,4}
So, the following IF expression must be TRUE, but it’s false:
if (allVariables.contains(cols[0])) {
//...
}
What’s the problem?
Contains is only going to look for the type that the list actually represents.
So if you have a list of
Integer[], you are not going to be able to ever pass in anintand get atrueresult (sinceintcannot benull).To do that you’d have to do a deep search yourself: