| View previous topic :: View next topic |
| Author |
Message |
Gladis
Joined: 24 May 2006 Posts: 108
|
| But C++ is faster with worse code. So. |
| |
|
|
|
|
Aaron Zapashniy
Joined: 04 Jun 2006 Posts: 17 Location: Hungary
|
| Now i read something about variance.. and what i briefly read gave me the impression that i'd be able to specify my method as void doIt(List<Parent..>) or void doIt(List<-Parent>) |
| |
|
|
amoralis
Joined: 22 Jun 2006 Posts: 21
|
This issue Aaron Zapashniy raised is obnoxious because you can't overload methods with the only different in parameters being the object parameterizing the generic collection
I.e. doIt(List<parent> list); can't be overriden by doIt(List<Child> list); |
| |
|
|
Gladis
Joined: 24 May 2006 Posts: 108
|
Aaron Zapashniy, List<? extends Parent>
Which includes Parent and all subclasses of parent. |
| |
|
|
Aaron Zapashniy
Joined: 04 Jun 2006 Posts: 17 Location: Hungary
|
OOooh
That's nice! |
| |
|
|
Gladis
Joined: 24 May 2006 Posts: 108
|
| Or the completly useless <? super Parent>, which is the superclass and all subclasses of superclasses of Parent. |
| |
|
|
Aaron Zapashniy
Joined: 04 Jun 2006 Posts: 17 Location: Hungary
|
Gladis, <Object>  |
| |
|
|
amoralis
Joined: 22 Jun 2006 Posts: 21
|
| <- still can't use generics on a regular basis |
| |
|
|
martinar_kauaro
Joined: 18 Jun 2006 Posts: 4
|
| ? extends Foo is bad, it's not better than no generics. |
| |
|
|
Gladis
Joined: 24 May 2006 Posts: 108
|
Aaron Zapashniy, Ah, but it's more typing and harder to read!
It must be better! |
| |
|
|
|