Collection The root interface in the collection hierarchy.
A collection is a group of objects known as its elements.
Some collections allow you to duplicate elements, while others do not.
Some of them are ordered and others are not ordered.
To get a really good idea of โโwhat is appropriate for each collection and their performance characteristics, I would recommend getting an idea of โโdata structures such as arrays, linked lists, binary search trees, hash tables, as well as stacks and queues. In fact, there is no way to learn this if you want to be an effective programmer in any language.
HashMap is used only for cases when there is a logical reason to have special keys corresponding to the values
source share