Collections Classes Flashcards

1
Q

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.

A

ArrayList

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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.

A

LinkedList

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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.

A

TreeSet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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.

A

HashMap

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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.

A

TreeMap

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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.

A

PriorityQueue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly