Marshall Schor wrote:
Sounds right. But we should use bounded wildcards for "arguments" where
appropriate (of course, this doesn't apply to getViewIterator, which has
no arguments). The article,
http://www.ibm.com/developerworks/java/library/j-jtp07018.html?S_TACT=105AGX02&S_CMP=EDU
has a nice "principle" called the "get-put" principle for arguments:
Use an |extends| wildcard when you only get values out of
a structure, use a |super| wildcard when you only put values
into a structure, and don't use a wildcard when you do both.
For the last part, he also says the reason for not using a wild card if you do
both:
If you can put a |T| or any of its subtypes, and you can get a |T| or any
of its supertypes, then the only thing you can both get and
put is a |T| itself.
Well, I was aware of the get part, but it does not always makes sense,
in my eyes,
e.g. when a method receives a List<String> from somewhere.
I never used the put part of the rule, which may indicate I did
something wrong
in a very few places, because output Lists for example are rarely used.
Jörn