For example my list contains {4, 6, 6, 7, 7, 8} and I want final result = {6, 6, 7, 7}
One way is to loop through the list and eliminate unique values (4, 8 in this
Have a
Map numberToOccurance = new HashMap();
maintain count and number, at the end iterate keyset and get values with more than one count