redho home | products | services
Web Design Forums

Web Design Forums  


Web Hosting, Web Design, Software and Web Development Forums  
 FAQFAQ   MemberlistArchive  Log inLog in   RegisterRegister 
         

adding generics


Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    Web Design Forums -> JAVA programming forum
View previous topic :: View next topic  
Author Message
amoralis



Joined: 22 Jun 2006
Posts: 21
It seems like it should be valid, please explain why it isn't valid
  Reply with quote


Ikopar



Joined: 26 May 2006
Posts: 168
List<Parent> list = new ArrayList<Parent>(); list.add(instanceOfChild);
Because generics don't work that way, there's no inheritence
  Reply with quote
amoralis



Joined: 22 Jun 2006
Posts: 21
Ikopar: perhaps in that list instance you don't want parent to be accepted
  Reply with quote
Ikopar



Joined: 26 May 2006
Posts: 168
Read the generics FAQ or tutorial, they cover this topic much better than I could
  Reply with quote
amoralis



Joined: 22 Jun 2006
Posts: 21
Perhaps you only want a specific child object there
Not that I have a use case but maybe Aaron Zapashniy does heh
  Reply with quote
Ikopar



Joined: 26 May 2006
Posts: 168
You generally don't want that
  Reply with quote
Aaron Zapashniy



Joined: 04 Jun 2006
Posts: 17
Location: Hungary
I see. hm. interesting. okay.
Should still work fine, as 99% of the time i think i'm only performing parent methods when acting on collections.
  Reply with quote
amoralis



Joined: 22 Jun 2006
Posts: 21
Generics in java kinda suck
  Reply with quote
Aaron Zapashniy



Joined: 04 Jun 2006
Posts: 17
Location: Hungary
Is it just me or does the term generics seem completely contrary to what they actually are?
They're not generics. they're specifics.
Treating things as Object is generic.
  Reply with quote
Gladis



Joined: 24 May 2006
Posts: 108
"templates" would be a better word for them.
Except that was taken. By something GOOD.
  Reply with quote
Page 2 of 5 Goto page Previous  1, 2, 3, 4, 5  Next
Post new topic   Reply to topic    Web Design Forums -> JAVA programming forum


Dubai Forums - Expat Help | Vegan Chat | Java Programming | Free 3D tutorials and 3d textures | Paris Forum | EU Forum
Free Dubai Classifieds | Free London Classifieds | Jobs in London

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

Powered by phpBB © 2001, 2005 phpBB Group