Collections quick review
There are times in our developer lives when we just settle with a range of implementations without thinking of the reasons behind it, or without having any valid argument in order to use one implementation over another.
Some time ago I was having a discussion with a friend [which is a big data developer] about the importance of choosing the right collection. He gave an example on how using the wrong implementation a job took over 3 hours, after changing the implementation of the collection used the same job needed 5 minutes to complete.
Below can be seen a table with basic information about different implementations of collections
|HashMap||✗||✗||✗||One null key andno null values|
|Hashtable*||✗||✗||✓||No null keys and no null values|
|TreeMap||✗||✓||✗||Accepts nulls as keys and value|
|LinkedHashMap||✓||✗||✗||Accepts nulls as keys and value||Faster iterations than HashMap but slower inserts and remove|
|ArrayList||✓||✗||✗||Accepts null||Fast iterations|
|LinkedList||✓||✗||✗||Accepts null||Fast iterations and deletion|
* There is not a typo: Hashtable is the special kid that does not have camel case
PS: This is just a quick review for more about how each works, I suggest visiting the API.