Snippets

cutiko Arrays, List, HashSet and TreeSet convertions

Created by cutiko

File Arrays.java Added

  • Ignore whitespace
  • Hide word diff
+public class MyClass {
+
+    /*Convert List to HashSet*/
+    myHashSet = new HashSet<Integer>(myList);
+
+    /*Convert HashSet to Array*/
+     Object[] myArray = mySet.toArray();
+     
+    /*Convert List to TreeSet*/
+    TreeSet<Integer> myTreeSet = new TreeSet<>(myList);
+     
+     
+
+}
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.