Snippets

cutiko Arrays, List, HashSet and TreeSet convertions

Created by cutiko
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);
     
     

}

Comments (0)