Collections, what to use?
Collection interface has many implementations, like ArrayList, LinkedList, TreeSet and others. With so many variations, some times you don’t known what to use, this depends of your objective. Now I’ll try to explain some differences in ArrayList, LinkedList and TreeSet.
ArrayList
The ArrayList Collection allow to store objects and null values, but your access is unordered, the first object inserted, can be a last to retrieve.
LinkedList
This implementation of Collection is like ArrayList, but the difference is in access to objects stored, where each object is returned in your inserted order.
TreeSet
If you want retrieve the objects of your Collection in specified order, this Collection can do the work! Insert values in TreeSet is equal previously classes, but your return depends of Comparable implemented in values. It sort your object values using result of compareTo method, inherited of Comparable Interface.
For more information, visits Collection Javadoc.