A Java list has repeated elements like
[cat, apple, iphone, football, apple, adam, apple, football, cat, people, cat]
cat
repeated 3 timesfootball
repeated 2 timesapple
repeated 3 times
How to extract only the repeated elements from the list such that the final list has
[cat, apple, football]
?