It depends a little on what you mean. You can't directly compare al4 with al2, because they're of different types: one is an ArrayList<String> and one is an ArrayList<ArrayList<String>>.
When you compare al1 and al2, what you're doing is determining, for each element of al1, whether it occurs anywhere in al2. I presume this is what you want. You are not deciding whether it occurs in the same place in al2.
The first thing you should do is improve this comparison, which is rather inefficient. Since you don't care about ordering of al2, you should rewrite the comparison like this:
ArrayList<String> al3 = new ArrayList<String>();
Set<String> al2set = new HashSet<String>(al2);
for (String temp : al1)
al3.add(al2set.contains(temp) ? "Yes" : "No");
This is a lot more efficient because you don't have to traverse the whole of al2 for each lookup.
Now, if you want to compare your list of lists with a list, I can only assume that you mean you want to tell, for each element of any of the lists in al4, whether it occurs in al2. If so, then you want
ArrayList<String> al3 = new ArrayList<String>();
Set<String> al2set = new HashSet<String>(al2);
for (List<String> tempList : al4)
for (String temp : tempList)
al3.add(al2set.contains(temp) ? "Yes" : "No");
This will give you one flat ArrayList<String>, recording, for each element of the lists of al4, whether that element was in al2 somewhere.
It is possible that you want your result to be an ArrayList<ArrayList<String>>, so that the result mimics the structure of al4, in which case it's only slightly more complicated:
ArrayList<ArrayList<String>> al3list = new ArrayList<ArrayList<String>>();
Set<String> al2set = new HashSet<String>(al2);
for (List<String> tempList : al4) {
ArrayList<String> al3 = new ArrayList<String>();
for (String temp : tempList)
al3.add(al2set.contains(temp) ? "Yes" : "No");
al3list.add(al3);
}
After executing this, a3list will have the same structure as al4, and each element of each list will be either "Yes" or "No", according to whether the corresponding element in al4 was contained somewhere in al2.