Here's a set of strings.
Set<String> nameSet = new TreeSet<>(Arrays.asList("Mr.Green", "Mr.Yellow", "Mr.Red"));
Output each of its elements with the loop with a new line.
Here's a set of strings.
Set<String> nameSet = new TreeSet<>(Arrays.asList("Mr.Green", "Mr.Yellow", "Mr.Red"));
Output each of its elements with the loop with a new line.
Sample Input 1:
Sample Output 1:
Mr.Green
Mr.Red
Mr.YellowCreate a free account to access the full topic