Is there an easy way to check a container if it contains a value, not an object? This is the code I’d like to work:
String[] i = {"One", "Two", "Three"};
if (Arrays.asList(i).contains("One")){
return true;
}
Is there a way to do this or will I have to loop through the array myself?
That should work fine. A String is an object, so you can use the
contains(Object)overload (which is based onequals).