I can’t link to the link, but the design of the List and Set implementations of the Collection interface is mostly extensible Array s. Since Collections by default, offers methods for dynamically adding and deleting items at any point where there is no Array , the insertion order may not be preserved. Thus, since there are many methods for manipulating content, there is a need for special implementations that preserve order.
Another point is performance, since the most effective Collection may not be the one that maintains its insertion order. However, I'm not sure exactly how Collections manage their content to improve performance.
So, in short, there are two main reasons why I can think about why there are Collection implementations that preserve order:
- Class Architecture
- Performance
FK82 Sep 12 '10 at 8:24 2010-09-12 08:24
source share