user93796 user93796 - 3 months ago 8
Java Question

How to make a new List in Java

We create a

Set
as:

Set myset = new HashSet()


How do we create a
List
in Java?

Answer
List myList = new ArrayList();

or with generics

List<MyType> myList = new ArrayList<MyType>();