
In this article i'll describe some basics about java collections
ArrayList
An ArrayList is better than Array to use when you have no knowledge in advance about elements number. ArrayList are slower than Arrays. So, if you need efficiency try to use Arrays if possible.Also it is not synchronized. The add operation runs O(n) time.Permits null elements
Vector
Very similar to the ArrayList class. Slover than ArrayList .Also it is synchronized.
LinkedList
LinkedList is much more flexible and lets you insert, add and remove elements from both sides of your collection - it can be used as queue and even double-ended queue.Manipulation with data is fast but accessing to some element only after showing all.
HashMap
A hash table or hash map is a data structure that uses a hash function to map identifying values, known as keys(Key -- Value) HashMap is not synchronized.HashMap allows one null key and any number of null values.
HashTable
Is very similar to the HashMap. It's synchronized.Hashtable does not allow null keys or values.
HashSet
Set is a collection of distinct objects.It stores its elements in a hash table.Order -undefined.Performance - better than LinkedHashSet
LinkedHashSet
is implemented as a hash table with a linked list running through it.Order - insertion.Performance - has fast adding to the start of the list, and fast deletion from the interior via iteration
TreeSet
It stores its elements in a red-black tree.Order - ascending.Performance - Slow
References:
TreeSet vs HashSet vs LinkedHashSet
Array vs ArrayList vs LinkedList vs Vector
Java Collections