| Author |
Creating a LinkedList of class objects
|
Richard Shelly
Greenhorn
Joined: Oct 03, 2005
Posts: 24
|
|
im trying to create a linked list of objects that are instantiated from a class i have written. i was wondering how to make the list of a specific type. also, i have to create a way of naming each object in the list. by this i mean i have to create an object, it needs to have a name automatically generated (there are rules about the naming.), how can i do this? the names are an alternation sequense of chars, and digits. e.g A1, A2B4, A2D4F5. hope this makes enough sense.
|
 |
ramprasad madathil
Ranch Hand
Joined: Jan 24, 2005
Posts: 489
|
|
All collections allow you to hold any kind of objects. This is true for LinkedLists too. If you use java 5, you could specify that your collection would hold Objects of only a certain type. If you user defined class is, say, MyClass, then would ensure that the list would accept objects of type MyClass only. Its not possible, as far as I know, to dynamically assign names to the reference variables of the Objects of your class. cheers, ram.
|
 |
Richard Shelly
Greenhorn
Joined: Oct 03, 2005
Posts: 24
|
|
thanks Ram. the 'names' to which i referred are strings within the defined class. if that changes anything.
|
 |
 |
|
|
subject: Creating a LinkedList of class objects
|
|
|