My one regret in life is that I am not someone else.
- Woody Allen
My one regret in life is that I am not someone else.
- Woody Allen
Campbell Ritchie wrote:And that old thread didn’t help at all, did it?
My one regret in life is that I am not someone else.
- Woody Allen
Campbell Ritchie wrote:I am surprised you found that thread any help at all. The second one you found is hardly better.
The two words are not strictly defined, and you should not consider two types of collection. You should consider three:-Ordered collections: One can predict which element will be found when by the Iterator by knowing when that element was added to the collection. Sorted collections: One can predict which element will be found when by the Iterator by knowing the relative values of the elements. Unordered collections: One cannot predict which element will be found when by the Iterator from their values nor by knowing which was added when.
Lists Stacks and most Queues are ordered, Sets and Maps are usually unordered, but some sets (as you will have seen from the second link you posted) are sorted. You will probably find more in the Java Tutorials.
My one regret in life is that I am not someone else.
- Woody Allen
Campbell Ritchie wrote:Ordered collections: One can predict which element will be found when by the Iterator by knowing when that element was added to the collection.
vinay chaturvedi wrote:Ordered means the order in which the elements are added in a collection is maintained.
vinay chaturvedi wrote:Sorted means the elements added in to a collection will be added in their natural sorting order.
Campbell Ritchie wrote:Unordered collections: One cannot predict which element will be found when by the Iterator from their values nor by knowing which was added when.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |