We create a Set as:
Set
Set myset = new HashSet()
How do we create a List in Java?
List
List myList = new ArrayList();
or with generics (Java 7 or later)
List<MyType> myList = new ArrayList<>();
or with generics (Old java versions)
List<MyType> myList = new ArrayList<MyType>();
2.1m questions
2.1m answers
60 comments
57.0k users