| Author |
Generics & collections question
|
Thierry Henry
Greenhorn
Joined: Jun 20, 2007
Posts: 1
|
|
Hi, i'm trying to create a type L that extends a List containing elements of type E. I can't create an instance in the above example.. Anyone has some pointers or an example of how to go about this?
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
If I'm not mistaken, this is unfortunately not possible, because of the way Java generics currently work (with type erasure). See this from Angelika Langer's excellent Java Generics FAQ: Can I create an object whose type is a type parameter?
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: Generics & collections question
|
|
|