This discussion is archived
1 Reply Latest reply: Jan 24, 2012 9:53 AM by jtahlborn RSS

instantiating anonymous Type as method argument...

886206 Newbie
Currently Being Moderated
hi,

trying to do this, i guess i have stumbled upon a noob's syntax error. any help please?
    private <T extends Dimension> void fillArray(T dim, ArrayList<T> arrayList) {
        for (int i=0; i<dim.getDim();i++) {
            arrayList.add(new <T>(i+1));
        }
    }
the error is spotted in the third line and the compiler says: <identifier> expected

thnx!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points