Flashcards
LinkedList structure
Hover (or tap) to flip
A doubly-linked list implementation of List and Deque, optimized for insert/remove at ends.
Learn moreCopyOnWriteArrayList trade-off
Hover (or tap) to flip
Great for many reads/few writes; expensive when writes are frequent due to copying.
Learn moreCopyOnWriteArrayList concurrency model
Hover (or tap) to flip
On write operations, it creates a new copy of the underlying array to avoid locking readers.
Learn moreTreeMap sorting property
Hover (or tap) to flip
TreeMap keeps keys sorted (natural order or Comparator) and supports range queries.
Learn moreMap interface purpose
Hover (or tap) to flip
A Map associates unique keys to values and allows efficient retrieval by key.
Learn moreHashMap collision strategy
Hover (or tap) to flip
Collisions are handled via buckets (linked lists) and may treeify into balanced trees in some cases.
Learn moreHashMap key-value mapping
Hover (or tap) to flip
HashMap stores key-value pairs and provides fast lookup on average.
Learn moreHashSet equality contract
Hover (or tap) to flip
Uniqueness depends on a consistent equals() and hashCode() implementation.
Learn moreHashSet internal backing
Hover (or tap) to flip
HashSet is typically backed by a HashMap internally.
Learn moreChoosing TreeSet
Hover (or tap) to flip
Use TreeSet when you need sorted order and navigable operations (e.g., floor/ceiling).
Learn moreSet uniqueness rule
Hover (or tap) to flip
A Set does not allow duplicate elements.
Learn morePriorityQueue common use
Hover (or tap) to flip
Useful for scheduling, shortest-path algorithms, and any “process next best” workflow.
Learn morePriorityQueue ordering rule
Hover (or tap) to flip
Elements are ordered by natural ordering or a Comparator; head is the smallest/highest-priority element.
Learn moreArrayDeque use case
Hover (or tap) to flip
Prefer it for LIFO/FIFO operations when you don’t need thread safety or priority ordering.
Learn moreArrayDeque structure
Hover (or tap) to flip
A resizable-array implementation of Deque that supports both stack and queue operations efficiently.
Learn morePriority-based queue
Hover (or tap) to flip
PriorityQueue processes elements by priority (natural order or Comparator), not strict insertion order.
Learn moreQueue interface behavior
Hover (or tap) to flip
Represents a FIFO (first-in, first-out) structure for ordered processing.
Learn moreWhy is Java main method static?
Hover (or tap) to flip
main is static so the JVM can call it without instantiating the class.
Learn moreJava main method signature
Hover (or tap) to flip
public static void main(String[] args) is the conventional entry-point signature recognized by the JVM.
Learn moreSRP maintainability benefit
Hover (or tap) to flip