I have implemented Java methods to resolve IN and OR condition.
Below is my code.
public static <T> boolean in(T parameter, T... values) {
if (null != values) {
System.out.println("IN values size.. " + values.length);
return Arrays.asList(values).contains(parameter);
}
return false;
}
public static boolean or(boolean... values) {
System.out.println("OR values size.. " + values.length);
return in(true, values);
}
public static void main(String[] args) {
System.out.println(or(false, true, false));
}
Output is:
OR values size.. 3
IN values size.. 1
false
But I was expecting the following output:
OR values size.. 3
IN values size.. 3
true
I don't understand why varargs size in 1 in in
method.