Search |
||
(Not So) Stupid Questions 16: What's the Difference Between Wildcard Generics and no Generics?
Tue, 2007-02-20
Editor's note: Sometimes the most interesting discussions begin when someone says, "This may be a stupid question, but ...." If the person asking the question has taken the time to think about the problem before asking, the question is often not stupid at all. The uncertainty points out an ambiguity in the specs, holes in the docs, or a search for how more experienced programmers might address a particular problem. From time to time, we will print one of the "(Not So) Stupid Questions" we receive and invite our readers to answer the question in the feedback section. Remember that new people are joining the Java community all the time and may be looking for help from those with more experience. Also, those who began with Java as their first language can benefit from those coming to the community with experience in other languages. As always, answer the questions with kindness. You are also welcome to submit your questions to
This may be a stupid question, but ... "What is the difference between specifying a wildcard for a genericized type and not using the generic notation at all?"First thoughts: Take this for example:
It makes me wonder what the benefit is for specifying wildcard generic types for an API. If I were to rewrite the interface's method to return a plain old So I don't get it: What's the point of specifying a wildcard for a genericized type, when you can just omit the generics altogether? »
Related Topics >>
Programming
Comments
Comments are listed in date ascending order (oldest first)
|
||
|