Collections Flashcards

(18 cards)

1
Q

List

A

Accepts duplicates, has an index number.

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

ArrayList

A

retrieving is faster (Get) holds non-primitive data-types

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

LinkedList

A

Add, addAll, remove, removeIf, retainAll.

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

Vector

A

A synchronized version of ArrayList

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

Stack

A

Syncronized version of arraylist With LIFO (last in first out) organization, pop() = LIFO

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

Set

A

doesn’t accept duplicates, does not have an index

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

HashSet

A

Random

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

LinkedHash Set

A

keeps assertion order

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

TreeSet

A

Ascending order doesn’t accept Null.

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

Queue

A

Accepts duplicates, No index, FIFO (first in first out)

poll() = FIFO

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

Iterable

A

Only for collections. Allows to properly remove objects.

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

HashMap

A

Keys are in random order.

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

LinkedHashMap

A

Insertion order

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

TreeMap

A

Ascending order doesn’t accept Null

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

HashTable

A

Keys are in random order, synchronized, does not accept null.

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

Collections List Key Points

A

A list is an ordered collection of elements. Some languages call it a sequence or an array of varying lengths.

17
Q

Collections Set Key Points

A

A collection that contains no duplicate elements. Like a mathematical Set the interface denotes a collection that holds elements and basically answers a single question: is a given element contained in the set.

Doesn’t specify the order of elements when you iterate them, but all set implementations are created with the performance of the contains method in mind.

Two Implementations would be HashSet and TreeSet
HashSet: hashes the elements and distributes them into buckets by the hash value. Tree Set is backed by a balanced tree, which makes it ordered and navigable.

Typically use-cases for sets do not require navigating from element to element so the HashSet is the goto implementation you’ll tend to use.

18
Q

Collections Queue Key Points

A

a Queue is designed to hold elements prior to processing, the elements wait in line to be consumed and can be added to the tail of the queue.

Queues are those fundamental pieces of software that tie components together. IE: when components are communicating in a system, there’s typically a queue of messages sitting between them.

Queues are a special sort of collection as they mainly use the Queue interface, rather than methods inherited from the Collections Interface. IE: .offer / .poll / .peek