Loop through the items of an HashSet with a for-each loop:

Example

for (String i : cars) {
  System.out.println(i);
}



Practice Excercise Practice now