I have a list of strings , I browse it and count number of "x" strings as below but the count doesn't print me the expected value:
ArrayList<Integer> list = new ArrayList<Integer>();
List<String> strings = table.getValue(); //this gives  ["y","z","d","x","x","d"]
int count = 0;
for (int i = 0; i < strings.size(); i++) {
    if ((strings.get(i) == "x")) {
        count++;
        list.add(count);
    }
}
System.out.println(list);
this gives [] it should be 2 as I have 2 occurrences of "x"
 
     
     
     
     
     
    