Use a TreeSet instead of HashSet