Order of elements in LinkedList
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Meenu_Ahluwalia
Posted On:   Wednesday, June 6, 2001 11:33 PM

Does LinkedList in Java maintain the order in which the elements were inserted?
For eg, if I insert obj2,Obj10,Obj7 in the linkedlist in the order mentioned,
when I try to retrieve the elements from the linkedlist, does it give me in the same order as they were inserted (obj2,obj10,obj7) or does it retrieve in a random order.

Re: Order of elements in LinkedList

Posted By:   C_Walker  
Posted On:   Thursday, June 7, 2001 10:40 AM

Any List, including LinkedList and ArrayList, maintains the order
in which the elements are inserted. This is in contrast with
the hash-based collections which store elements according to
a hash number.
About | Sitemap | Contact