The Java Collections Framework (List, Set, Map, Queue, Deque), Comparable and Comparator, iterators, and generics with wildcards and bounds.
40 cards · basic cards · AI-written, checked twice. Edit anything.
- What is the root interface of the Java Collections Framework?
Show answer
Collection
- What are the three main branches extending from the Collection interface?
Show answer
List, Set, and Queue
- Is Map part of the Collection interface hierarchy?
Show answer
No, Map is a separate interface root that does not extend Collection
- What is ArrayList?
Show answer
A resizable array-based implementation of List, backed by a dynamic array
- What is LinkedList?
Show answer
A List implementation using a doubly-linked list of nodes
- What is the key speed tradeoff between ArrayList and LinkedList?
Show answer
ArrayList has fast random access but slower insertion/deletion at the beginning; LinkedList has faster insertion/deletion but slower access
- What does the Set interface guarantee about its elements?
Show answer
No duplicate elements are allowed
- What is HashSet?
Show answer
An unordered Set implementation based on a hash table
- What is LinkedHashSet?
Show answer
A Set that maintains insertion order using a hash table with linked structure
- What is TreeSet?
Show answer
A sorted Set implementation using a red-black tree, ordered by natural ordering or a custom Comparator
- Name the three main List implementations
Show answer
ArrayList, LinkedList, Vector
- Name the three main Set implementations
Show answer
HashSet, LinkedHashSet, TreeSet
- What does Map store as its basic unit?
Show answer
Key-value pairs, also called entries
- What is HashMap?
Show answer
An unordered Map implementation using a hash table
- What is TreeMap?
Show answer
A sorted Map implementation using a red-black tree, sorted by keys