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); }
Programming Tips - Java: Best way to enumerate a HashSet
Date: 2014mar25
Language: Java
Keywords: iterate
Q. Java: Best way to enumerate a HashSet
A. Its totally easy.