(String[] args)
| 6 | |
| 7 | public class SetOfString { |
| 8 | public static void main(String[] args) { |
| 9 | Set<String> colors = new HashSet<>(); |
| 10 | for(int i = 0; i < 100; i++) { |
| 11 | colors.add("Yellow"); |
| 12 | colors.add("Blue"); |
| 13 | colors.add("Red"); |
| 14 | colors.add("Red"); |
| 15 | colors.add("Orange"); |
| 16 | colors.add("Yellow"); |
| 17 | colors.add("Blue"); |
| 18 | colors.add("Purple"); |
| 19 | } |
| 20 | System.out.println(colors); |
| 21 | } |
| 22 | } |
| 23 | /* Output: |
| 24 | [Red, Yellow, Blue, Purple, Orange] |