Results 1 to 5 of 5
- 02-27-2009, 05:54 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 9
- Rep Power
- 0
-
It's quite easily possible, and one way is to create a non-generic ArrayList (an ArrayList without the <> part). Having said that, I don't recommend that you do this except in unusual circumstances. What type of two different objects precisely will this list be holding?
- 02-27-2009, 07:25 PM #3
Member
- Join Date
- Jan 2009
- Posts
- 9
- Rep Power
- 0
It will hold to different objects that I have created, Router and Computer.
- 02-27-2009, 07:32 PM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Do they both use the same base class? If so, use that base class as the generic type. Otherwise, although it kind of defeats the purpose, use Object. In either case, you will need to cast the retrieved objects to make "full use" of them once retrieved.
- 02-27-2009, 08:51 PM #5
Member
- Join Date
- Jan 2009
- Posts
- 9
- Rep Power
- 0
Similar Threads
-
read txt file,with some records, create objects and store objects in tables of a db.
By stamv in forum JDBCReplies: 1Last Post: 01-22-2009, 04:25 PM -
Two Objects
By losintikfos in forum New To JavaReplies: 3Last Post: 11-14-2008, 07:04 PM -
1 to 1 Objects
By this.that in forum New To JavaReplies: 4Last Post: 08-07-2008, 10:09 PM -
Java Project Trouble: Searching one ArrayList with another ArrayList
By BC2210 in forum New To JavaReplies: 2Last Post: 04-21-2008, 11:43 AM -
Help with Objects!
By Shorinhio in forum New To JavaReplies: 1Last Post: 07-10-2007, 09:32 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks