Iterating over a set in Java
Forums:
HashSet<Character> chars =
new HashSet<Character>(Arrays.asList('A', 'B', 'C', 'D'));
String str = "";
for (Character c : chars) {
str += (str == "" ? "" : "; ") + c;
}
//str is "B; A; C; D"
- Log in to post comments