×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Added: May 5, 2021 3:43 PM
Views: 3986
Tags: collections
  1.    public static void main(String[] args) {
  2.  
  3.         //Initialisieren wie ArrayLists
  4.         var colors = new HashSet<String>();
  5.  
  6.         // use add() method to add values in the hash set
  7.         colors.add("Red");
  8.         colors.add("Green");
  9.         colors.add("Black");
  10.         colors.add("White");
  11.         colors.add("Pink");
  12.         colors.add("Yellow");
  13.  
  14.         //print out HashSet
  15.  
  16.         System.out.println(colors);
  17.     }
  18. }
  19.