Re: JDom and Java5
"Gregor Zeitlinger" <[email protected]>
| Newsgroups | gmane.comp.java.jdom.general |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Feb 23, 2008 at 3:51 PM, Rolf <[email protected]> wrote: > As for Mattias's original claim that List<?> can be cast to > List<Element> if you know the content will be only Elements, then, I > believe that lends a certain weight to List<?>, but, is the same not > true for List<Object>? Yes, all of the discussed variations can be cast, but not all are equivalent (see below). > Does this make sense? I think this is (yet another) design flaw of Java generics. 1) List: this is pre-generics legacy code 2) List<?>: this construct should have been disallowed, as it's equivalent to List<? extends Object> 3) List<Object>: a list where objects can be read and written 4) List<? extends Object>: a list where can be read only -- Gregor Zeitlinger [email protected] _______________________________________________ To control your jdom-interest membership: http://www.jdom.org/mailman/options/jdom-interest/[email protected]