Programming Tips - How do I enumerate a HashSet?

Date: 2014mar25 Language: Java Keywords: iterate Q. How do I enumerate a HashSet? A. Its totally easy.
HashSet<String> set = new HashSet<String>(); set.add("one"); set.add("two"); set.add("three"); for (String s : set) { // Very simple code to enumerate // The elements will not be the order they were added System.out.println(s); }