Answers for "site:stackoverflow.com List is abstract; cannot be instantiated public List<Integer> result = new List<>();"

0

site:stackoverflow.com List is abstract; cannot be instantiated public List<Integer> result = new List

In Java, List is an interface. That is, it cannot be instantiated directly.

Instead you can use ArrayList which is an implementation of that interface 
that uses an array as its backing store (hence the name).

Since ArrayList is a kind of List, you can easily upcast it:

List<T> mylist = new ArrayList<T>();

-source: stackoverflow.com
Posted by: Guest on January-01-1970

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language