• Post Reply Bookmark Topic Watch Topic
  • New Topic

how do i extend ArrayList in this way?  RSS feed

 
Micah Pezdirtz
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to extend ArrayList<E>, but...i dont know what to put in the child class or how, when i declare an object of the child class, to do the, uh, <E> part
i dont know the right term/word for it, but how do i make my constructer so i can use the <E> thing? e.g.

i'm sorry if this sounds very vague, but...i really feel a large gap connecting what i know and what i need to do
 
Henry Wong
author
Sheriff
Posts: 23280
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Micah Pezdirtz:
i want to extend ArrayList<E>, but...i dont know what to put in the child class or how, when i declare an object of the child class, to do the, uh, <E> part
i dont know the right term/word for it, but how do i make my constructer so i can use the <E> thing? e.g.


Well, it really depends on what you want done. For example, if you want to declare a Buffer that takes a type, of which is stored in the arraylist, then...



may be what you want. If you want to declare a buffer that takes multiple types, of which one will be stored in the arraylist, then...



may be what you want. If you want to declare a buffer that takes multiple types, of which none will be stored in the arraylist. The arraylist is forced to only store strings, then...



may be what you want. etc...

Henry
 
Micah Pezdirtz
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wow thanks! i knew what i wanted but didnt know how to ask a question so i would get an answer that would be what i needed. you sure hit the nail right on the head, thanks for clearing thing up for me!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!