asullaherc asullaherc - 1 year ago 96
Groovy Question

MalformedParameterizedTypeException when use ArrayList<ArrayList<>>

Here is my code:

class TestDraft {
ArrayList<ArrayList<String, Double>> a = []

static void main(String[] args) {
new TestDraft().a.add(["pr", 2])

It raise:


when I change
ArrayList<ArrayList<String, Double>>
it work, but I hope to what cause:


Answer Source
ArrayList<ArrayList<Integer, Integer, Integer>>

doesn't make any sense (which I think is what the error is telling you)

It should just be:


To say that you have a list of lists of integers... Generics do not express how many elements are in a List