Wednesday 15 June 2011

java - Difference between wildcare generic vs no generic parameter -



java - Difference between wildcare generic vs no generic parameter -

this question has reply here:

difference between generic type , wildcard type 7 answers

in java, difference between:

public void foo(list lst);

and

public void foo(list<?> lst);

afaik:

just using list lst raw type, hence not typesafe. generate runtime error when casting bad. want compile time error when cast bad. not recommended use. additional info on raw types : what raw type , why shouldn't utilize it?

in case of list: unbounded wildcard.

java generics

No comments:

Post a Comment