Collection Framework interfaces:
1. Lists - Lists of things (ex. Lists of students).
2. Sets - Set is a collection where all the values are unique.
3. Maps - Map is a collection that holds key/value pairs. A unique key is mapped to a specific value, where both the ‘key’ and ‘value’ in are objects.
Terminologies:
1. Ordered - You can iterate through the collection in a specific order.
2. Sorted - Collection is sorted in the natural order (alphabetical for Strings).
LISTS
Arraylist - uses arrays internally for data management.
to be used when:
- you need a resizable-array implementation of List interface
- you need an ordered collection
- should be considered when there is more data retrieval that adding or deleting of elements.
- you need an ordered collection
- should be considered when thread safety is a concern.
- you need an ordered collection
- faster insertion/deletion and slower retrieval when compared to ArrayList.
- you need an unsorted and unordered Map
- you need a map that allows null key and null values
- methods are not synchronized. thread safety is not a concern
- you need an unsorted and unordered Map
- should be considered when security is important
- you need a map that allows null key and null values
- methods are synchronized. thread safety is a concern
- has more utility methods than HashMap
reference: COLLECTIONS – WHAT HAPPENS WITHIN -Compiled by Sharad Ballepu