This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You know, this could have been tested in 60 seconds (or less than the time it took to write the post) by just creating an ArrayList yourself, adding elements to it and then printing them out. You could then see if it was ordered.
Originally posted by Kashif Riaz: You know, this could have been tested ...
Well, yes, but you can't necessarily count on the results of this kind of test. You don't know if it's a quirk of the implementation, or if it's guaranteed behavior, until you read the documentation. From the javadocs:
An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list.
Joined: Mar 09, 2005
Thanks ranchers - for the help and yes Kashif - I did implement and check - believe me but just wanted some experts here to verify that my understanding was correct - and as usual excellent people here are ready to help .
Thanks once again to all who have taken the trouble of helping me out