I want check whether a String value val
is contained within a List of Strings lets call it stringList.
I am doing this
if(stringList.con
More code please!
This works:
import java.util.*;
public class Contains {
public static void main(String[] args) {
List stringList = new ArrayList();
stringList.add("someString");
String val = new String("someString");
if (stringList.contains(val)) {
System.out.println("The value is in there");
} else {
System.out.println("There's no such value here");
}
}
}