Q:

Java - check intersection of two strings

I'm having a way to check for insection of two strings, which are all characters, seperated by a comma.
if(brauen[p] > 35){
                m1 = "A, S";
            }else if(brauen[p] <=35 && brauen[p]>20){
                m1 = "T";
            }else{
                m1 = "W";
            }
            if(mund[p] > 50){
                m2 = "S";
            }else{
                m2 = "T, W, E";
            }
            if(augen[p] > 25){
                m3 = "A, S";
            }else{
                m3 = "T, V, E";
            }

            List<String> l1 = Arrays.asList(m1.split(","));
            List<String> l2 = Arrays.asList(m2.split(","));
            List<String> l3 = Arrays.asList(m3.split(","));
            List<String> result = l1.stream().filter(l2::contains).collect(Collectors.toList());
            resultString = String.join(",", result);
            System.out.println(resultString);

The code is in a for loop, iterating over an array.
What I don't understand now: If i define single strings (like above the defintion of the three lists), like so:
 String s1 = "T,V,E";
 String s2 = "T,W,E";

then its working and the result is T,E, as excepted. 
But with the code I provided its not working, and I only get the string T or an empty string as result.
The weird thing: l1 and l2 are defined correctly, if I just print those after the definition, the values are correct, and the intersections should be W and S too. 
So I really can't find any problem about it, if I basically define the same strings above, like I said, so:
String s1 = "T,V,E";
 String s2 = "T,W,E";

or
String s1 = "A,S";
 String s2 = "S";

then its working, but if I use the Lists that get the values from m1 and m2 it's not working, although the list looks exactly the same.
Can anybody please help me out?

A:

Just put the letters into a Collection of some description (could be List, could be Set if you want to discard duplicates):
Set<String> first = new LinkedHashSet<>(Arrays.asList(s1.split(","));
Set<String> second = new LinkedHashSet<>(Arrays.asList(s2.split(","));

Then just remove all the elements from first that aren't in second (or, another way to look at it, retain only the elements in first which are in second):
first.retainAll(second);

Now join them again:
String intersection = String.join(",", first);

