Vote Up 0 Vote Down

Search if an item or a sublist is in a List

We would like to know how to search if an item or a sublist is in a List.

answer


Vote Up 0 Vote Down
import java.util.Arrays;
import java.util.List;
public class MainClass {
  public static void main(String[] a) {
    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    System.out.println(list.contains("C"));
  }
}
flag | link

your answer

Who Are You?

Have an account already? Login before answering!