Got an ArrayList like that. Wanna find how many values are repeated: Example: person:4 times , girl:4 times
public ArrayList<String> new_contains_all= new ArrayList<>();
...
[[laying, beautiful, brushing, group, young, head, bed, close, couple, female, teeth, white, indoor, pair, holding, sunglasses, stuffed, wearing, posing, dress, person, hair, standing, looking, girl, red, playing, made, top, woman, lady, hat, clothing, goggles, people],
[person, hair, young, shirt, looking, phone, girl, white, glasses, food, sunglasses, wearing, woman, hat], [blue, beautiful, person, cake, standing, young, shirt, black, female, board, girl, white, photo, holding, ready, wearing, top, posing, woman, lady, smiling, clothing, dress, suitcase], [street, clock, light, stop, sign, red, text, sitting,
man, photo, traffic], [blue, person, young, looking, phone, sitting, female, girl, photo, computer, using, red, laptop, holding, glasses, food, sunglasses, wearing, top, woman, lady, hat]]
Notify that the Array have 5 elements inside.
Already tried this, that should be working for simple ArrayList but with more than 1 string per element its creepy, i know the solution must implement another bucle inside key, but so tired for today :/ maybe someone blinks my mind :P
List<String> l = new_contains_all;
Set<String> s = new HashSet<String>(l);
for (String key : s) {
int count = Collections.frequency(l, key);
if (count > 1)
System.out.println("Found '" + key + "' " + count + " times."+"key: "+key.toString()+"l: "+l.toString());
}