Java code to find the top 10 most frequent strings through iterator