I have two lists where some information is stored. Elements of first list are extracted from a DB (they are the ingredients of recipes), in the second list some favourite ingredients are stored. I want to compare both lists and when the ingredients match I want to add 1 to a sum.
My problem is when I parse the first list the ingredients are compared with the second list, but in my first list I have elements that are not made from one string( one element has 2-3 words), and when I compare the lists, are compared only the last elements, aren't compared the components of elements.

First list : 

```
[200 grame fusilli cu legume (spanac si mere);
200 grame smantana 12%; 
50 grame iaurt; 
50 grame cascaval afumat; 
1/2 lingurite mustar; 
doi catei de usturoi sau o lingurita de usturoi deshidratat; 
o lingur? ulei de masline; 
mere]

```

Second list: 

```
[afine, almette, alune, alune, albus de ou de gaina, alune, andive, mere]

```

And my result is 

```
[0, 0, 0, 0, 0, 0, 0, 0, 0]

```

We can saw that word "mere" is met twice in first list an once in second list,but the result is 0. How can I resolve the problem?

Here is my java code:

```
rs=ps.executeQuery();                           
while( rs.next()){
String nrRet = rs.getString("Ingrediente");          
firstList.add(nrRet);                  
}
System.out.println(firstList);
Statement st1 = con.createStatement();
rs1 = st1.executeQuery("Select Nume from ingredientplacut where Id_user = '24'");

 while( rs1.next()){
   String nrRet1 = rs1.getString("Nume");
   secondList.add(nrRet1);                                
   }

   System.out.println(secondList);      
   ArrayList<String> al3= new ArrayList<String>();
   for (String temp : firstList)
   al3.add(secondList.contains(temp) ? "Yes" : "No");
   System.out.println(al3);

   ArrayList<Integer> al4= new ArrayList<Integer>();
   for (String temp2 : firstList)
   al4.add(secondList.contains(temp2) ? 1 : 0);
   System.out.println(al4);

```

My output is:

```
First list : [200 grame fusilli cu legume (spanac si **mere**);
200 grame smantana 12%; 
50 grame iaurt; 
50 grame cascaval afumat; 
1/2 lingurite mustar; 
doi catei de usturoi sau o lingurita de usturoi deshidratat; 
o lingur? ulei de masline; 
**mere**]
Second list: [afine, almette, alune, alune, albus de ou de gaina, alune, andive, mere]

```

And My result is `[0, 0, 0, 0, 0, 0, 0, 0, 0]` instead of `[0, 0, 0, 0, 0, 0, 0, 0, 1]`

Could anyone help me? Thanks!