Can anyone please explain this code to me, I don't have much coding experience with Collections so I am having difficulties in understanding these LOC.
String[] stringList ={"1","2","1","1","2","3","2","3","2","1"}; List<String> al =Arrays.asList(stringList); Set<String> uniqueList = new HashSet<String>(al); for (String strCount :uniqueList) { System.out.println(strCount + ": " + Collections.frequency(al, strCount)); } Why does this loop only run 3 times while uniquelist has all the members of stringList. Shouldn't the loop run 10 times (length of uniqueList)?