The next two lines are identical (for the compiler), this is true even if you have a class named Value , since the named parameter will mask the class type
class RowList<Value> extends ArrayList<List<Value>> class RowList<T> extends ArrayList<List<T>>
The reason for this is that the value inside the first <> is a parameter of the named type. So when you try to do something like
class RowList<List<Value>> extends ArrayList<List<Value>>
You tried to create a named parameter of type List<Value> , which (in Java) is an invalid identifier, but instead you get the Syntax error on token(s), misplaced construct(s) error message
I think instead you are really trying to write
public class RowList extends ArrayList<Value> { @Override public boolean add(Value e) {
Where Value is a custom object in your codebase. Then elsewhere in your code, you can:
RowList rl = new RowList(); rl.add(new Value(...)); Value v = rl.get(i);
EDIT:
The previous example assumes that the Value class is a data entry string. If instead it is the only data item and the string is represented by List, then it will be more like the following:
public class RowList extends ArrayList<List<Value>> { @Override public boolean add(List<Value> e) {
source share