Collections Classes Flashcards
Internally implemented as a resizable array. One of the most widely used concrete classes. Fast to search, but slow to insert or delete, allows duplicates.
ArrayList
Internally implements a doubly-linked data structure. Fast to insert or delete elements, but slow for searching. Can be used when you need a stack or queue data structure. Allows duplicates.
LinkedList
Internally implements a red-black tree data structure. Does not allow storing duplicates. Stores elements in sorted order. Position of elements is decided by sort order.
TreeSet
Internally implemented as a hash table data structure. Stores key and value pairs. Uses hashing for finding a place to search or store a pair. Searching or inserting is very fast. It does not store the elements in any order.
HashMap
Internally implemented using a red black data tree structure. Stores the elements in a sorted order. Stores key and value pairs. Elements are sorted by key.
TreeMap
Internally implemented using a heap data structure. Retrieves elements based on a priority. Irrespective of the insertion order, when an element is removed, the highest priority element is removed first.
PriorityQueue