I have created a Java class MyObject:
public class MyObject
{
public final String s;
public final int i;
public final int j;
...
}
I want to create a List of this type, but I am getting a “Cannot instantiate the type List” error
private java.util.List<MyObject> myObjectss = new java.util.List<MyObject>();
I tried the solution in this question (4 vote answer) but I get a “The type List is not generic; it cannot be parameterized with arguments ” error…
Java Linked List How to create a node that holds a string and an int?
Listis an interface and therefore cannot be instantiated. You could try:ArrayListis a class that implements theListinterface.Edit Just saw that you needed a
LinkedList, try this: