I came across a curious situation involving static general methods. This is the code:
class Foo<E> { public static <E> Foo<E> createFoo() { // ... } } class Bar<E> { private Foo<E> member; public Bar() { member = Foo.createFoo(); } }
Why don't I need to specify any type arguments in a Foo.createFoo() expression? Is this some kind of output? If I want to be explicit, how do I specify a type argument?
java generics static type-inference
fredoverflow Mar 14 '11 at 11:32 2011-03-14 11:32
source share