What is the most efficient way to search for a single element in an ArrayList
of ArrayLists
? Given the following:
ArrayList<ArrayList<Integer>> intList = new ArrayList<ArrayList<Integer>>();
ArrayList<Integer> a = new ArrayList<>();
a.add(1);
a.add(2);
ArrayList<Integer> b = new ArrayList<>();
b.add(3);
b.add(4);
intList.add(a);
intList.add(b);
How would I search to see if the ArrayList
intList
contains a specific Integer
, like 3
?