← Back to Java

Java Glossary

Key terms from the Java course, linked to the lesson that introduces each one.

3,257 terms.

#

`AutoCloseable`
is the more general parent interface for *any* resource that needs cleanup.
Lesson 824AutoCloseable vs CloseableLesson 1946AutoCloseable and Closeable Interfaces
`Class` object
that acts as a gateway into Java's *reflection API*.
Lesson 573Class Objects and Reflection Entry PointLesson 2320What is the Class Object?
`ClassNotFoundException`
is a **checked exception** that occurs when your code *explicitly* tries to load a class by name at runtime (using reflection or similar mechanisms), but Java can't find it.
Lesson 807ClassNotFoundException and NoClassDefFoundErrorLesson 2141The readObject Method Signature
`DirectoryStream`
A **lazy iterator** that fetches directory entries one-by-one as you loop through them.
Lesson 2080DirectoryStream vs Files.list: When to Use WhichLesson 2083Performance Considerations for Large Directories
`filter`
evaluates the predicate against *every* element in the stream, keeping those that match and discarding those that don't.
Lesson 1473takeWhile vs filter: Key DifferencesLesson 1809Real-World Example: Safe Property Access
`findFirst()`
returns the first element in the stream that matches your filtering criteria (or just the first element if no filter is applied).
Lesson 1412Terminal Short-Circuiting: findFirst and findAnyLesson 1541Understanding findFirst and findAny Terminal Operations
`getSupportedAnnotationTypes()`
Returns which annotations your processor handles (e.
Lesson 2454The Processor InterfaceLesson 2455AbstractProcessor: A Convenient Base Class
`getSupportedSourceVersion()`
Declares which Java version your processor supports
Lesson 2454The Processor InterfaceLesson 2455AbstractProcessor: A Convenient Base Class
`keySet()`
Iterates through keys in your chosen order (insertion or access)
Lesson 1150Iteration Order GuaranteesLesson 1391Stream from Map: entrySet(), keySet(), values()
`opens`
Allows deep reflection on *all* types (public and non-public), but doesn't grant normal access
Lesson 2490Syntax of opens in module-info.javaLesson 2533Dealing with Reflection-Heavy Frameworks
`pop()`
→ Maps to `removeFirst()` — removes and returns the front element
Lesson 1198Stack Methods: push, pop, and peekLesson 1212push and pop: Stack Operations on Deque
`removeLast()`
A bit trickier in doubly-linked lists, but still efficient by starting from `tail`.
Lesson 1021Head and Tail ReferencesLesson 1205Removing Elements: removeFirst, removeLast, pollFirst, pollLast
`thenCompose`
Use when your function takes a value and returns a **`CompletableFuture`** (like calling another async operation)
Lesson 2818thenCompose vs thenApply: When to Use WhichLesson 2829thenCombine vs thenCompose: Key Differences
`values()`
Iterates through values in the *same* order as their corresponding keys
Lesson 1150Iteration Order GuaranteesLesson 1391Stream from Map: entrySet(), keySet(), values()

A

Absolute paths
specify the complete location of a file or directory from the root of the filesystem.
Lesson 2027Absolute vs Relative Paths
Abstraction
Your method can throw domain-specific exceptions without exposing implementation details
Lesson 769Wrapping Exceptions: throw new Exception(cause)
Abstraction cost
Collections vary in structure (linked nodes, hash tables, trees)
Lesson 1392Collection.stream() vs Arrays.stream() Performance Considerations
Accented characters
é, ñ, ü (common in European languages)
Lesson 1998ASCII and Its Limitations
Access
| Through object instance | Through interface name only |
Lesson 518Static Methods vs Default Methods: Key Differences
Access control
Abstract class methods can be `protected` or package-private.
Lesson 513Default Methods and Abstract ClassesLesson 658What Are Packages and Why They Matter
Access Control Violations
It bypasses compile-time accessibility checks in ways that are inconsistent with how `Constructor.
Lesson 2374Using Class.newInstance() and Its Deprecation
Access order
Entries move to the end when accessed (useful for LRU caches)
Lesson 1142LinkedHashMap Overview: Ordering in Maps
Access to annotated elements
`getElementsAnnotatedWith(MyAnnotation.
Lesson 2457The RoundEnvironment and Processing Rounds
Access to both ends
adding or removing from either front or back
Lesson 984Queue vs Deque: Choosing the Right End-Access Pattern
Access to class methods
– you can call `Number` methods like `doubleValue()` inside your generic class
Lesson 912Bounded Type Parameters with Classes
AccessDeniedException
occurs when the directory exists, but your process lacks the necessary read permissions.
Lesson 2082Error Handling: NoSuchFileException and AccessDeniedException
Accessor methods
(getters and setters) solve this by providing controlled access to private fields:
Lesson 338The Purpose of Getters and Setters
Accidental overloading
instead of overriding
Lesson 423Best Practices: Always Use @Override
Accumulator function
A binary operator that combines two values into one
Lesson 1506reduce with Identity: T reduce(T identity, BinaryOperator<T>)
Activity
Threads appear frozen, making no progress
Lesson 2703Detecting Livelock vs Deadlock
actual object's class
to find which version of the method to execute.
Lesson 461Method Resolution Process OverviewLesson 467Method Resolution with Interfaces
Actual parameters
(also called "arguments") are the real values or variables you pass into the method when you call it.
Lesson 197Method Parameters: Formal vs Actual Parameters
actual runtime type
of that object—not the declared type of the variable, but what the object *really* is at that moment.
Lesson 571The getClass Method: Runtime Type InformationLesson 2321Three Ways to Obtain a Class ObjectLesson 2323Using getClass() on Object Instances
Adaptive
Runs faster on partially sorted data
Lesson 1221Sorting Stability and Implementation Details
Add `implements Comparable<YourClass>`
to your class declaration
Lesson 1311Implementing Comparable in a Custom Class
Add a suffix
`classutils`, `packageinfo`
Lesson 682Avoiding Reserved Keywords in Package Names
Add getter methods
to access the field values
Lesson 587Declaring Fields in Enums
Add the requires directive
to your `module-info.
Lesson 2479Diagnosing Missing requires Declarations
Add validation
Ensure data integrity before accepting changes
Lesson 723Prefer private Fields with Controlled Public Methods
Adding context
Log additional state information before propagation
Lesson 745Re-throwing Exceptions After Partial Handling
Adding fields
New fields get default values (`null` for objects, `0` for numbers, `false` for booleans) when deserializing old data
Lesson 2164Versioning Problems and Class Evolution
Adding methods
Doesn't affect serialized state
Lesson 2126Compatible vs Incompatible Class Changes
Adding new fields
New fields get default values (null, 0, false) when reading old data
Lesson 2126Compatible vs Incompatible Class Changes
Adds another abstract method
→ No longer functional (2+ abstract methods)
Lesson 2420Inheritance and @FunctionalInterface
Adoptium
or **Amazon Corretto** are excellent choices.
Lesson 3Choosing a JDK Distribution: Oracle, OpenJDK, and Others
Adoptium (formerly AdoptOpenJDK)
– A popular, free distribution of OpenJDK backed by the Eclipse Foundation.
Lesson 3Choosing a JDK Distribution: Oracle, OpenJDK, and Others
Advances
the iterator's position forward by one element
Lesson 1276next(): Retrieving the Next Element
After `<< 2`
`0001 0100` (which is 20 in decimal)
Lesson 119Left Shift Operator (<<)
After `supplyAsync`
– catch initial failures early
Lesson 2852Combining handle with Other CompletableFuture Methods
After `thenCombine`
– handle errors from either of the combined futures
Lesson 2852Combining handle with Other CompletableFuture Methods
After a volatile read
All subsequent reads must fetch fresh values from main memory.
Lesson 2689volatile in the Java Memory Model: Formal Guarantees
After sleep completes
Thread transitions back to `RUNNABLE` state (now eligible for CPU time again)
Lesson 2592What Happens During sleep: Thread State Changes
Age of a person
`byte` (0–127 covers it)
Lesson 36Choosing the Right Integer Type for Your Data
Aggregations
counting, summing, averaging, finding min/max
Lesson 1522Why collect Is the Gateway to Advanced Collectors
Algorithm implementations
like Dijkstra's shortest path or Huffman coding
Lesson 1183What Is a PriorityQueue?
All 50 have completed
(success or failure) before proceeding
Lesson 2853Understanding the Need for Multiple Futures Coordination
All access levels
public, protected, private, and package-private methods
Lesson 2334Getting Declared Methods: Class-Specific Methods Only
All elements processed
, even if you only need one
Lesson 1410Contrasting Eager Collection Operations
All modules
gain deep reflective access, including third-party libraries you might add later.
Lesson 2492Unconditional opens: Opening Packages to All Modules
All-or-nothing updates
where every field in the method must change together
Lesson 2660When to Use Synchronized Methods
All-static methods
provide functionality
Lesson 392Real-World Examples: Java Standard Library
Allocate
a new array with the expanded capacity
Lesson 1008System.arraycopy: The Reallocation Mechanism
Allocates OS resources
It requests a new native thread from the operating system, which involves setting up a call stack, program counter, and other low-level resources needed for independent execution.
Lesson 2573The start() Method: Launching a Thread
Allow coordinated shutdown
of thread pools and executors
Lesson 2598Restoring Interrupt Status in catch Blocks
Allowed characters
Letters, digits, underscores, hyphens
Lesson 2289Username and Identifier Patterns
Already done
After `invokeAll` returns, calling `get()` on any `Future` won't block (though it may throw `ExecutionException`)
Lesson 2758invokeAll: Executing Multiple Callables
Alternative algorithms
Racing different algorithms solving the same problem (e.
Lesson 2767Use Cases: invokeAll vs invokeAny
Alternative approaches
for huge datasets might include pre-filtering, database-level deduplication, or external sorting algorithms—but those techniques aren't yet in your toolkit.
Lesson 1448Performance Implications of distinct on Large Streams
always executes
(whether an exception occurs or not), it's the perfect place to ensure cleanup happens.
Lesson 734Common finally Use Cases: Resource CleanupLesson 2846Processing Successful Results with handle
Always returns Double
Regardless of which variant you use, the result is always `Double`.
Lesson 1590The averagingInt, averagingLong, and averagingDouble Collectors
Always safe
You can read while others write, with no corruption or crashes
Lesson 1307ConcurrentHashMap and Weakly Consistent Iterators
Always use braces
to make your intent crystal clear:
Lesson 143Dangling else Problem: Ambiguity in Nested Conditionals
Always validate in `readObject`
Every custom `readObject` method should validate all fields after reading them.
Lesson 2166Best Practices for Safe Serialization
Amazon Corretto
– Amazon's free, production-ready distribution of OpenJDK with long-term support.
Lesson 3Choosing a JDK Distribution: Oracle, OpenJDK, and Others
Amortized analysis
averages the cost of operations over a sequence, rather than focusing on the worst single case.
Lesson 1016Amortized Analysis: Why O(1) Despite Occasional O(n)
Animation or timed events
Games, UI animations, or scheduled tasks often need precise timing between frames or updates.
Lesson 2590The Purpose of Thread.sleep
Annotation Processing Workflows
Both frameworks read annotations at runtime using the techniques you've learned: `isAnnotationPresent()`, `getAnnotation()`, and extracting element values.
Lesson 2388Common Use Cases: Frameworks and Libraries
anonymous classes
let you define a class inside a method, but they differ in naming, reusability, and flexibility.
Lesson 638Local Classes vs Anonymous ClassesLesson 649When to Prefer Lambdas Over Anonymous Classes
Any modification
to captured variables after the lambda is defined
Lesson 1721Attempting to Modify Captured Variables
Any one completes first
to return the fastest result
Lesson 2853Understanding the Need for Multiple Futures Coordination
API boundaries
Passing data between old and new code sections
Lesson 2032Converting Between Path and File
API compatibility
and **whether you need mutability**.
Lesson 1502Comparing toArray() with collect(toList())
API Surface Clarity
Overusing `opens` blurs the line between your public API (what you `export`) and your implementation details.
Lesson 2497Security and Design Trade-offs with opens
Application extensions
without redeployment
Lesson 2392Plugin Architectures and Extensibility
Applications where simplicity matters
more than micro-optimizing I/O
Lesson 1935Default Buffer Size: 8KB Explained
Apply different rejection policies
Define what happens when capacity is reached
Lesson 2866Why Custom Executors Matter: Isolation and Resource Control
Argument boxing/unboxing
overhead (primitives must be wrapped for invoke)
Lesson 2398Method Invocation Overhead: invoke vs Direct Calls
Argument count mismatches
Forgetting an argument or passing extras throws `MissingFormatArgumentException` or is silently ignored.
Lesson 2233Common Formatting Patterns and Pitfalls
Array covariance
Java arrays are covariant, meaning `String[]` is a subtype of `Object[]`.
Lesson 960Cannot Create Arrays of Parameterized Types
Array parameters
require the caller to explicitly create an array: `myMethod(new int[]{1, 2, 3})`
Lesson 222Varargs vs Array Parameters
Array wrapping
for arguments creates temporary objects
Lesson 2395Performance Overhead of Reflection
ArrayList's Iterator
Because `ArrayList` stores elements in a contiguous array, its iterator simply increments an index to move from element to element.
Lesson 1044Iteration Performance: Sequential Access Patterns
As a Queue (FIFO)
Add at the back, remove from the front
Lesson 1194Deque as Queue and Stack: Dual Behavior
As a Stack (LIFO)
Add and remove from the same end
Lesson 1194Deque as Queue and Stack: Dual Behavior
ASCII
Maps 128 basic English characters (A-Z, digits, punctuation) to single bytes
Lesson 1997What Is Character Encoding?
Asian scripts
Chinese characters ( 中⽂ ), Japanese (⽇本語 ), Korean (한국어 )
Lesson 1998ASCII and Its Limitations
Aspect-Oriented Programming (AOP)
, which separates cross-cutting concerns (logging, security, transactions) from business logic.
Lesson 2391Dynamic Proxies and AOP
Associativity
`(a op b) op c = a op (b op c)` (grouping doesn't matter)
Lesson 1507Identity Element Requirements: Associativity and Neutrality
At compile time
, Java checks whether a method *exists* on the **reference type** (the declared type of your variable).
Lesson 465The Role of the Reference Type at Compile TimeLesson 2240Line Terminator NormalizationLesson 2479Diagnosing Missing requires Declarations
At construction time
using a Thread constructor that accepts a name:
Lesson 2566Thread Naming and Identification
At critical save points
where data loss would be unacceptable
Lesson 1937flush: Forcing Buffered Data to Disk
At declaration
Assign the value immediately when you declare it
Lesson 71final and Initialization Requirements
At least one thread
will modify it (add, remove, update)
Lesson 1247Why Collections Need Synchronization
At the end
→ the stack should be empty (all brackets were matched)
Lesson 1215Stack Operation Examples: Balanced Parentheses
Atomic Operations
Methods like copy and move can be performed atomically when supported by the file system, preventing partial failures.
Lesson 2034Overview of Files Utility Class and Basic Operations
Autoboxing/unboxing
for primitive types adds object creation overhead
Lesson 2395Performance Overhead of Reflection
Automatic cleanup
both files close even if exceptions occur
Lesson 1986Complete Example: Reading and Writing Text Files
Automatic execution
`readObject()` runs automatically—no explicit method call needed
Lesson 2158Serialization as an Attack Vector
Automatic handling
Java serializes all non-transient fields
Lesson 2157Externalizable vs Serializable: Trade-offs and Decision Guide
Automatic queuing
Tasks wait their turn without additional code
Lesson 2720newFixedThreadPool: Creating a Fixed-Size Thread Pool
Automatic type conversion
Write primitives and objects directly without manual toString() calls
Lesson 2016PrintWriter Overview: Formatted Text Output
Averaging collectors
(`averagingInt`, `averagingLong`, `averagingDouble`) return **0.
Lesson 1594Handling Empty Streams with Summing and Averaging Collectors
Avoid `HashSet`
for enums—it wastes memory and sacrifices performance for no benefit.
Lesson 597Introduction to EnumSet: A Specialized Set for Enums
Avoid `Hashtable`
in modern code—if you need thread safety, use `ConcurrentHashMap` instead (covered later), which offers better concurrent performance
Lesson 1153Hashtable vs HashMap: Key Differences
Avoid ambiguous signatures
Two constructors with the same number and types of parameters will confuse the compiler.
Lesson 324Choosing Constructor Overload Signatures
Avoid frequent reallocations
– Growing too slowly (like by a fixed amount) means resizing often as the list grows large.
Lesson 1014The Growth Strategy: Multiplying Capacity by 1.5
Avoid Over-General Catches Early
Lesson 765Catch Order Best Practices
Avoid overusing them
importing too many static members can make code harder to read, as it becomes unclear where methods come from.
Lesson 672Static Import: Importing Static Members
Avoid symmetric parameter patterns
(swapping types between parameters)
Lesson 215Common Overloading Pitfalls and Ambiguity
Avoid uninitialized variable errors
(the compiler knows your variable has a value from the start)
Lesson 68Declaration and Initialization in One Statement
Avoid unnecessary casts
If you're frequently casting, reconsider your design
Lesson 799ClassCastException and Type Safety
Avoid wasting memory
– Doubling capacity (2×) can waste significant space, especially for large lists.
Lesson 1014The Growth Strategy: Multiplying Capacity by 1.5
Avoiding name collisions
Since Java is case-sensitive, `com.
Lesson 680Package Name Case Conventions: All Lowercase
Avro
provide compact binary formats with schema support.
Lesson 2165Alternatives to Java Serialization
Awareness
Developers immediately know they're using risky APIs
Lesson 2409@Deprecated: Compiler Warnings

B

Back off gracefully
release any locks you're holding and retry later
Lesson 2698Timeouts and tryLock: Breaking Potential Deadlocks
Back to step 2
– Repeats condition → body → update until condition becomes `false`
Lesson 166Executing for Loops: Step-by-Step Evaluation Order
Backed by an Array
Under the hood, `ArrayDeque` maintains a circular array.
Lesson 1202What is ArrayDeque? Overview and Purpose
Backpressure handling
When the queue reaches capacity, the executor can apply policies (reject tasks, block the submitter, etc.
Lesson 2713Task Queues: Buffering Work for Thread Pools
Backtrack or reverse direction
Problems that require undoing steps or going backward through decisions (like maze solving, undo features, or balanced parentheses)
Lesson 1218Stack vs Queue Trade-offs in Problem Solving
Bad names
`MyModule`, `module1`, `test`
Lesson 2463Basic Module Declaration Syntax
Bad practice
Modifying external variables or collections within stream operations creates **side effects** that break these guarantees.
Lesson 1373Stream Operations Are Functional and Side-Effect Free
Balanced entry/exit
Every lock acquisition must have a matching release
Lesson 2674Lock Acquisition Count: Entry and Exit Tracking
Be cautious with varargs
they're chosen *last*, but can still create confusion
Lesson 215Common Overloading Pitfalls and Ambiguity
Be efficient and safe
(using short-circuit evaluation when appropriate)
Lesson 157Writing Effective while Loop Conditions
Be explicit about precision
Don't write `%.
Lesson 2233Common Formatting Patterns and Pitfalls
Before checking file contents
while the stream is still open
Lesson 2121ObjectOutputStream.flush() and Stream Flushing
Before critical operations
Before starting a long computation where a crash would lose buffered data
Lesson 1985flush: Forcing Buffer Contents to DiskLesson 2121ObjectOutputStream.flush() and Stream Flushing
Before final consumption
– normalize results before `thenAccept`
Lesson 2852Combining handle with Other CompletableFuture Methods
Before long operations
Flush before starting a lengthy computation so partial results are saved.
Lesson 1957flush() and When to Use It
Before program termination
(if you might not call `close()`)
Lesson 1937flush: Forcing Buffered Data to Disk
Before reading responses
Flush output before waiting for input
Lesson 1931Flushing Output Streams
Before sleep
Thread is in `RUNNABLE` state (either actively running or ready to run)
Lesson 2592What Happens During sleep: Thread State Changes
Before the volatile write
All preceding writes (including non-volatile ones) must be flushed to main memory.
Lesson 2689volatile in the Java Memory Model: Formal Guarantees
Benchmark reality
Reflective instantiation can be **10-100x slower** than direct instantiation, depending on the constructor complexity and security setup.
Lesson 2378Performance and Security Considerations
Benefit
Compile-time verification that prevents runtime bugs, clearer intent for readers, automatic detection when refactoring breaks overrides
Lesson 423Best Practices: Always Use @OverrideLesson 1065Choosing Load Factor: Space vs Time Trade-offsLesson 2440Choosing the Right Retention Policy
Best case
Removing from known head/tail is O(1) total
Lesson 1041Time Complexity: Removal Operations
Best for
Standard objects, rapid development, when default behavior suffices
Lesson 2157Externalizable vs Serializable: Trade-offs and Decision Guide
best-effort
or indicates a programming error, use an unchecked exception or swallow the error
Lesson 826Exceptions in close()Lesson 1300What Is Fail-Fast Behavior?
Best-effort search
Multiple search strategies where any acceptable result is sufficient
Lesson 2767Use Cases: invokeAll vs invokeAny
Better for large datasets
Especially important when processing millions of records or expensive computations
Lesson 1613Performance Benefits of teeing Over Multiple Passes
Better security
Text-based formats like JSON don't execute code during parsing
Lesson 2165Alternatives to Java Serialization
Between `thenCompose` stages
– recover from one async operation before starting the next
Lesson 2852Combining handle with Other CompletableFuture Methods
Bidirectional traversal
Move forward *and* backward through your list.
Lesson 1282The ListIterator Interface Overview
Binary data
consists of raw bytes that represent non-textual information: images (`.
Lesson 1930Binary Data vs Text DataLesson 1967Reader vs InputStream: When to Use Which
Binary Operators
(two inputs, one output, all the same type):
Lesson 1688Primitive Specializations: IntUnaryOperator, LongBinaryOperator, etc.
Binary search
Check the middle, search left *or* right half recursively
Lesson 233When to Use Recursion: Tree Traversal and Divide-and-Conquer
BinaryOperator
Combines two values of the same type into one (you've used this with `reduce`)
Lesson 1629Common Functional Interfaces in java.util.function
Bind
"If yes, give me a Dog-typed variable I can use immediately.
Lesson 453Pattern Matching for instanceof: Basic Syntax
Birthdays
You were born on a specific date, not at a specific instant in UTC
Lesson 1836LocalDate: Representing Dates Without Time
Blanket synchronization hurts performance
Even when you're using `Vector` in single-threaded code (the most common case), you pay the cost of acquiring and releasing locks on every operation.
Lesson 1030What Is Vector: A Legacy Synchronized List
Blocking
`invokeAll` doesn't return until all tasks finish
Lesson 2758invokeAll: Executing Multiple Callables
Blocking I/O operations
(file/network reads): The common pool's threads would sit idle, starving other tasks
Lesson 2781Async Execution Models: Common vs Custom ExecutorsLesson 2866Why Custom Executors Matter: Isolation and Resource Control
Blocking only
You must call `get()` and block until completion
Lesson 2777What is CompletableFuture and Why Use It?
boolean expression
is any piece of code that evaluates to either `true` or `false`.
Lesson 54Boolean Expressions and Comparison ResultsLesson 157Writing Effective while Loop Conditions
Boolean field
Use `is` + capitalized name
Lesson 341Boolean Property Getters: is vs get
Boom
The compiler stops you immediately, preventing a breaking change that would invalidate all existing lambda usage.
Lesson 2417Using @FunctionalInterface with Custom Interfaces
Both resources
declared in one try-with-resources statement
Lesson 1986Complete Example: Reading and Writing Text Files
Both true
→ Result is `true`
Lesson 107Logical AND Operator: &&
bound
(the type constraint, if any) or with `Object` if no bound exists.
Lesson 891What Is Type Erasure?Lesson 894Bounded Type Parameters Become Their Bound
Bounded
`ArrayBlockingQueue`, circular buffer implementations—fixed capacity set at creation
Lesson 1172Queue Capacity Restrictions and Bounded Queues
Bounded concurrency
Limits parallel execution to prevent system overload
Lesson 2720newFixedThreadPool: Creating a Fixed-Size Thread Pool
Bounded thread pools
to prevent resource exhaustion
Lesson 2790Providing a Custom Executor to supplyAsync
bounded type parameters
(like `<T extends Number>`), the erasure works differently: the type parameter is erased to its **bound** instead of `Object`.
Lesson 894Bounded Type Parameters Become Their BoundLesson 910What Are Bounded Type Parameters?
Boxes
your `5` and `10` primitives into `Integer` objects
Lesson 2401Autoboxing Penalties in Reflective Method Calls
Boxing is unavoidable anyway
data already comes from a `List<Integer>`
Lesson 1698When to Use Primitive Specializations vs Generics
Boxing/unboxing primitives
All arguments pass through `Object[]`, forcing autoboxing
Lesson 2350Performance Costs of Reflective Invocation
Breaking Encapsulation Intentionally
When you use `opens`, you're explicitly allowing reflection to bypass the strong encapsulation that `exports` enforces.
Lesson 2497Security and Design Trade-offs with opens
Buffered efficiency
`BufferedReader`'s internal buffer minimizes disk reads
Lesson 2014Processing Large Files with readLine
Buffered I/O
(which you'll learn next) is like using a shopping cart to buy everything in one trip—far more efficient.
Lesson 1932The Problem with Unbuffered I/O: System Call Overhead
Buffered reading
One system call fills the entire buffer with many bytes.
Lesson 1951Unbuffered vs Buffered I/O: Performance Impact
Buffered writing
Bytes accumulate in the buffer.
Lesson 1951Unbuffered vs Buffered I/O: Performance Impact
Build tools and frameworks
in your stack don't yet fully support JPMS
Lesson 2524Migration Strategy: When to Use Module Path vs Classpath
Build tools handle it
Maven, Gradle, and IDEs manage classpaths automatically
Lesson 691The CLASSPATH Environment Variable
Build-time verification
Static analysis tools can check `.
Lesson 2436RetentionPolicy.CLASS Explained
Built-in buffering
PrintWriter buffers internally for efficiency
Lesson 2016PrintWriter Overview: Formatted Text Output
Built-in versioning
`serialVersionUID` manages evolution
Lesson 2157Externalizable vs Serializable: Trade-offs and Decision Guide
Bundling everything together
in a single file
Lesson 684What Is a JAR File?
Bytecode processors
Tools like ASM or ByteBuddy can read these annotations to modify or analyze compiled code
Lesson 2436RetentionPolicy.CLASS Explained

C

C#
and **Kotlin** chose a different path called **reified generics**, where type parameters remain available at runtime.
Lesson 966Reified Generics in Other Languages: What Java Lacks
Cached pool
Flexible scaling, better for sporadic workloads, risk of creating too many threads
Lesson 2865Creating Dedicated Thread Pools for CompletableFuture
Calculations
Finding all unique results from mathematical transformations
Lesson 1483Using distinct After Transformations
Call `equals()`
to find the exact match within that bucket
Lesson 546Why hashCode Matters for Hash-Based Collections
Call `getCause()`
to retrieve the original exception
Lesson 2753Handling ExecutionException from Callable Failures
Call `setAccessible(true)`
on the Method object
Lesson 2363Invoking Private Methods with setAccessible
Call the method again
Pass the simpler arguments to itself
Lesson 226The Recursive Case: Breaking Down the Problem
Calls `map.put(e, PRESENT)`
your element becomes a key, paired with the dummy value
Lesson 1049HashSet add: Calling HashMap put
Calls a blocking method
that responds to interruption (like `Thread.
Lesson 2599What Is Thread Interruption?
camelCase
start with lowercase, capitalize each new word (like `studentScore` or `maxHeight`).
Lesson 65Variable Declaration SyntaxLesson 204Method Naming Conventions: Verbs and Clarity
Can have access modifiers
(public, protected, package-private—not private)
Lesson 480Abstract Method Syntax and Rules
Can have constructors
You write constructors to initialize the abstract class's fields when subclasses are created.
Lesson 495Interfaces vs Abstract Classes: Initial Comparison
Can have instance fields
Abstract classes can maintain state that all subclasses inherit and share access to.
Lesson 495Interfaces vs Abstract Classes: Initial Comparison
Cancels remaining tasks
Once a task succeeds, the executor attempts to cancel the others to avoid wasting resources.
Lesson 2763invokeAny: Racing Multiple Callables
Cannot check type parameters
You can't write `if (item instanceof T)` because `T` doesn't exist at runtime—only `Object` does
Lesson 893Type Parameters Become Object
Cannot have any implementation
(no method body at all)
Lesson 480Abstract Method Syntax and Rules
Cantor Principle
(named after set theory): the contract is one-directional, not bidirectional.
Lesson 551The Cantor Principle: Why the Contract Is Not Bidirectional
Capacity Management
Tracking available resource slots (like parking spaces numbered 1-100) where you need to quickly find the lowest available number (`pollFirst()`) or check what's available above/below a threshold.
Lesson 1101TreeSet as NavigableSet: Practical Applications
capture conversion
it invents a fresh, invisible type parameter to represent "whatever specific type this wildcard actually is.
Lesson 954Introduction to Capture ConversionLesson 956Capture Helper Methods Pattern
Capture results
Store values computed inside a loop or conditional for use later
Lesson 191Declaring Variables Before Control Structures
Capture the stack trace
– The JVM walks through the entire call stack, recording every method call to build the detailed stack trace you see when debugging
Lesson 755Performance Impact of Unwinding
captures
any exception thrown by your task and stores it inside the returned `Future` object.
Lesson 2734Exception Handling with submit: Future.get ThrowsLesson 2793Exception Handling in supplyAsync
Cargo (element)
The actual data you're storing (a String, Integer, or any object)
Lesson 1020Node Structure in LinkedList
Case sensitivity
Usually case-insensitive
Lesson 2289Username and Identifier Patterns
Case-insensitive
User input where "March" vs "march" shouldn't matter
Lesson 1893Case Sensitivity and Strict vs Lenient Parsing
Cast expressions
What type are you explicitly casting to?
Lesson 1727What Is Target Typing?
Cast the lambda explicitly
to the desired functional interface type
Lesson 1715Inference Limitations and Ambiguity
Catch `ExecutionException`
when calling `Future.
Lesson 2753Handling ExecutionException from Callable Failures
Caution
Overusing `import static *` can make code less readable—it's unclear where members come from.
Lesson 377Importing Static Methods and Fields
Caveat
External code can also synchronize on `this`, potentially causing unintended contention or deadlock.
Lesson 2663Choosing the Lock Object
Chain further operations
Attach another `thenRun()`, `thenAccept()`, or exception handlers
Lesson 2810Return Types: CompletableFuture<Void> for Both Methods
Chain to maximize reuse
Always have simpler constructors call more complex ones using `this()`.
Lesson 324Choosing Constructor Overload Signatures
Chainability
Since methods return new objects, you can chain operations cleanly:
Lesson 1899Replacing Calendar Arithmetic with Period and Duration
Chainable
You can call `thenApply` multiple times to build a pipeline
Lesson 2797What thenApply Does: Synchronous Transformation
Change implementation
Modify internal storage without breaking external code
Lesson 723Prefer private Fields with Controlled Public Methods
Change it
when you make **incompatible changes** that would break deserialization anyway:
Lesson 2130Best Practices for serialVersionUID Management
Change the `serialVersionUID`
explicitly to signal incompatibility (deserializing old data will fail fast)
Lesson 2164Versioning Problems and Class Evolution
Changes not reflected
Modifications made after iterator creation won't appear during iteration
Lesson 1305What Is Fail-Safe Behavior?
Changing a field's type
A String becoming an int can't be safely converted
Lesson 2126Compatible vs Incompatible Class Changes
Changing field access modifiers
(private to public, etc.
Lesson 2126Compatible vs Incompatible Class Changes
Changing field types
A field that was `String` is now `Integer`
Lesson 2164Versioning Problems and Class Evolution
Changing the `serialVersionUID`
explicitly without handling compatibility
Lesson 2126Compatible vs Incompatible Class Changes
Changing the class hierarchy
Moving or removing superclasses
Lesson 2126Compatible vs Incompatible Class Changes
Character class
matching one or more valid local-part characters
Lesson 2282Matching Email Addresses with Regex
Cheap computation
(like a literal or existing variable):
Lesson 1789Performance Comparison: orElse vs orElseGet
Check before you cast
Always use `instanceof` when the type is uncertain
Lesson 799ClassCastException and Type Safety
Check the line above
too—sometimes the real mistake is earlier
Lesson 14Understanding Compilation Errors
Check the source
Know whether your collection is already synchronized before wrapping it
Lesson 1253Nested Synchronized Wrapper Anti-Pattern
Check-then-act patterns work safely
no other thread can change conditions between the check and the action
Lesson 2649Why Single-Threaded Code Doesn't Have These Issues
Checking flags
(reading bits) uses the `&` operator:
Lesson 123Practical Uses: Bit Flags and Masking
Checks
that no cycles exist
Lesson 2476The Readability Graph
Checks the flag
using methods like `Thread.
Lesson 2599What Is Thread Interruption?
Checks the return value
`HashMap.
Lesson 1049HashSet add: Calling HashMap put
Choose `break`
when: You need to stop the entire loop early (found a match, hit an error condition, reached a limit)
Lesson 178break vs continue: When to Use Each
Choose `continue`
when: You want to skip processing for specific cases but keep checking remaining items (filtering, validation)
Lesson 178break vs continue: When to Use Each
Choose `runAsync` for
Logging, sending notifications, cache updates, cleanup tasks — actions without meaningful results.
Lesson 2792When to Use supplyAsync vs runAsync
Choose `supplyAsync` for
Database queries, API calls, complex calculations, file reading — anything producing data.
Lesson 2792When to Use supplyAsync vs runAsync
Circular references
are equally dangerous: Object X references Y, Y references X.
Lesson 2160The Billion Laughs Attack and Resource Exhaustion
Clarifies intent
Signals "this doesn't depend on object state"
Lesson 367Common Use Cases for static Methods: Utility Functions
Clarity of intent
When someone reads your production code, every operation should serve the business logic.
Lesson 1462Removing peek in Production Code
CLASS annotations
persist in bytecode for bytecode analysis tools but aren't loaded into memory when the JVM runs your program.
Lesson 2379Annotation Retention and Runtime Availability
Class file size
Increases (annotations stored in bytecode)
Lesson 2441Retention Policy and Performance Implications
Class first (if present)
If you're bounding by a class, it *must* come first
Lesson 921Syntax: Combining extends with &
Class object
itself, not on any particular instance.
Lesson 2665Class-Level Locks with synchronized(ClassName.class)
Class-level (static)
The blueprint itself might track "How many houses have been built from this blueprint?
Lesson 358What static Means: Class-Level vs Instance-Level
Class-level type parameters
are declared on the class itself and are visible throughout the entire class—in all instance fields, constructors, and methods.
Lesson 862Type Parameter Scope: Class-Level vs Method-Level
Class-Path
Lists external JAR files or directories your application needs:
Lesson 686The JAR Manifest File
Classes themselves
that need to be used across your application
Lesson 329public: Universal Accessibility
ClassNotFoundException
occurs when you explicitly try to load a class (like with reflection or dynamic loading) and it's simply not on the classpath:
Lesson 693Common Classpath Issues and ClassNotFoundException
CLASSPATH environment variable
on your system.
Lesson 691The CLASSPATH Environment Variable
Classpath order problems
If you have multiple versions of the same class, the wrong one might load first.
Lesson 693Common Classpath Issues and ClassNotFoundException
Clean APIs
with public interfaces separated from internal implementation
Lesson 2525Assessing Your Application's Readiness for Modules
Clean chaining
Works smoothly with modern Comparator factory methods:
Lesson 1357Sorting Lists with List.sort()
Clean, safe, and concise
The resource closes automatically—even if exceptions occur.
Lesson 838Try-With-Resources vs Traditional Try-Finally
Cleaner API
(Java 9+) for rare cases needing cleanup hooks
Lesson 574The finalize Method: Legacy Cleanup Mechanism
Cleanup logic
Put your resource cleanup code inside `close()`
Lesson 825Implementing AutoCloseable
Clear distinction from classes
Classes follow PascalCase (like `MyClass`), so lowercase packages make it immediately obvious what's a package and what's a class.
Lesson 680Package Name Case Conventions: All Lowercase
Clear purpose
The type parameter `E` obviously represents the element type
Lesson 900ArrayList<E> as the Canonical Generic Collection
Clear stack semantics
Methods like `push()`, `pop()`, and `peek()` work exactly as expected
Lesson 1211Why Deque Is Preferred Over Stack Class
Clearer API boundaries
When your module exports only 2-3 packages instead of 10, users immediately understand what they should depend on.
Lesson 2488Best Practices: Minimizing Exported API Surface
Clearer intent
You're modifying the variable, not creating a new value
Lesson 129Assignment Operators: =, +=, -=, *=, /=, %=
Clearer separation of concerns
`Path` represents locations; the `Files` utility class performs operations
Lesson 2025Introduction to NIO.2 and the Path Interface
Clearing flags
(turning bits off) uses `& ~`:
Lesson 123Practical Uses: Bit Flags and Masking
Clears the interruption flag
(resets it to `false`)
Lesson 2602Checking and Clearing: Thread.interrupted()
Cloning final fields
Remember, `clone()` conflicts with `final` fields when you need to replace them with deep copies.
Lesson 570Clone Best Practices and Common Pitfalls
Close the resource
Closing the underlying stream/socket from another thread will cause the blocked operation to fail with an exception
Lesson 2607Interruption and Non-Interruptible Blocking
Closed connections
Trying to use a connection that's already been closed
Lesson 806SQLException: Database Access Errors
Closed hierarchies
(with `final`) enforce boundaries—think `String` or `Integer`.
Lesson 431Design Decisions: When to Use final
Cluttered
The ceremony obscures your actual logic
Lesson 452The Boilerplate Problem: Test-Cast-Use Pattern
Coarse-grained
Large synchronized blocks or entire methods.
Lesson 2666Synchronized Block Scope and Granularity
coarse-grained locking
one big lock protecting the entire data structure.
Lesson 1154Synchronization Overhead in HashtableLesson 2660When to Use Synchronized Methods
Code generation
Adding proper indentation to generated source code
Lesson 2221The indent Method: Adding Leading Whitespace
Code generation tools
that scan source files before compilation
Lesson 2434RetentionPolicy.SOURCE Explained
Code reusability
One ArrayList implementation works for all reference types because `Object` is the universal superclass
Lesson 1001The Object Array Backing Store
Code will be maintained
by others (or future you)
Lesson 2275Named Groups vs Numbered Groups
Cohesive packages
that logically group related functionality
Lesson 2525Assessing Your Application's Readiness for Modules
Collection API methods
(`contains()`, `addAll()`, etc.
Lesson 1502Comparing toArray() with collect(toList())
Collection phase
Iterate through all `Future` objects, calling `get()` to retrieve each result
Lesson 2748Practical Pattern: Submitting Multiple Tasks and Collecting Results
Collections Framework
is Java's standardized architecture for representing and manipulating groups of objects.
Lesson 967The Collections Framework: Purpose and Design
Collections Holding Non-Serializable Objects
Lesson 2109Common NotSerializableException Scenarios
Collections that grow indefinitely
Lesson 301Memory Leaks in Java
Collections.singleton(element)
Returns an immutable Set containing one element:
Lesson 1255Collections.singleton, singletonList, and singletonMap
Collections.singletonList(element)
Returns an immutable List containing one element:
Lesson 1255Collections.singleton, singletonList, and singletonMap
Collections.singletonMap(key, value)
Returns an immutable Map containing one key-value pair:
Lesson 1255Collections.singleton, singletonList, and singletonMap
Collections.sort(List, Comparator)
Lesson 1334Passing Comparators to Sort Methods
Collections.synchronizedMap
is a *wrapper* that takes any `Map` implementation and adds synchronization around it.
Lesson 1156Thread Safety: Hashtable vs Collections.synchronizedMapLesson 1166When to Use ConcurrentHashMap vs Synchronized HashMap
Collision clusters
Bad luck or bad hashing creates "hot" buckets
Lesson 1112Performance Characteristics: O(1) Average Case
Collision prevention
Different teams can work independently without naming conflicts
Lesson 658What Are Packages and Why They Matter
Combinatorial explosion
The number of possible lock acquisition sequences grows factorially with more threads and resources, making testing nearly impossible.
Lesson 2694Deadlock with Multiple Threads and Resources
Combine with other futures
using functional composition
Lesson 2777What is CompletableFuture and Why Use It?
Common pattern
Counting and looping by ones is ubiquitous in programming
Lesson 96Increment and Decrement Operators: ++ and --
Common scenario
Your application uses a persistence framework (like Hibernate) that needs reflective access to your entity classes.
Lesson 2493Qualified opens: Opening Packages to Specific Modules
Communicates intent
Tells developers "this interface is designed for lambdas"
Lesson 1636When @FunctionalInterface is Optional
Compact and efficient
optimized memory layout with no wasted space
Lesson 1244Immutable Factory Methods: List.of, Set.of, Map.of
Compact memory
Only the exact number of slots needed
Lesson 603EnumMap Performance: Array-Based Implementation
Comparator complexity
A complex `compare()` method (one that does expensive computations) gets called O(n log n) times.
Lesson 1364Sorting Performance Considerations
Comparator factory methods
are static methods that generate `Comparator` instances for common patterns.
Lesson 1337Introduction to Comparator Factory Methods
Compilation Error
If ambiguity can't be resolved, the compiler rejects the code with an error message about ambiguous method calls.
Lesson 1732Ambiguity and Overload Resolution
Compile-time checking
Typos become compile errors instead of runtime surprises.
Lesson 578What Are Enums and Why They Matter
Compile-time declaration, runtime binding
You declare the interface you need, but implementations are discovered dynamically
Lesson 2500The 'uses' Directive in module-info.java
Compile-time processing
Happens while `javac` compiles your code (before any `.
Lesson 2453Compile-Time vs Runtime Annotation Processing
Compile-time verification
where the annotation's job is done once the compiler validates something
Lesson 2434RetentionPolicy.SOURCE Explained
Compiler enforcement
Try-with-resources only accepts `AutoCloseable` types, catching errors at compile time
Lesson 829Why AutoCloseable Matters
Compiler optimizations
The compiler may reorder operations or cache values in registers
Lesson 2680The Visibility Problem: Why volatile Exists
CompletableFuture's `thenApply()`
transforms a single asynchronous value in a pipeline:
Lesson 2805thenApply vs map in Stream API
Completion trigger
The returned future completes when all input futures complete (successfully or exceptionally)
Lesson 2854CompletableFuture.allOf: Waiting for All Tasks
Complex classpaths
Modern applications have hundreds of libraries, increasing gadget chain possibilities
Lesson 2158Serialization as an Attack Vector
Complex comparisons
When comparing objects with expensive comparison logic
Lesson 1362Parallel Sorting with parallelSort()
Complex expressions
where contextual information is too distant
Lesson 1731Target Type from Cast Expressions
Complex Generic Types
If the inferred type isn't immediately obvious from context, explicit types document your intent.
Lesson 1717Type Inference Benefits and Readability
Composability
Build complex rules from simple ones using `and()`, `or()`, `negate()`
Lesson 1645Predicates for Validation and Business Rules
Composable
Each intermediate operation returns a new stream, enabling chaining
Lesson 1480Understanding the Pipeline Pattern
Compose multiple pipelines
Combine this stage with others using methods like `allOf` or `anyOf`
Lesson 2810Return Types: CompletableFuture<Void> for Both Methods
Composition over inheritance
When you implement `Runnable`, you're defining *what work should be done*—a task.
Lesson 2569Thread vs Runnable: Design Trade-offsLesson 2572Creating a Thread with Runnable
Compound assignment operators
(`+=`, `-=`, `*=`, `/=`, `%=`) include a **built-in implicit cast** back to the type of the left operand.
Lesson 84Compound Assignment Operators and Implicit CastingLesson 129Assignment Operators: =, +=, -=, *=, /=, %=
Comprehensive validation
Running multiple independent validation checks where all must pass
Lesson 2767Use Cases: invokeAll vs invokeAny
Compressing the contents
to reduce file size
Lesson 684What Is a JAR File?
Concurrent applications
where multiple threads access the same file
Lesson 2052Atomic Writes and File Creation Guarantees
Concurrent collections
High-contention scenarios, frequent reads/writes from many threads, performance-critical applications
Lesson 986Synchronized Collections vs Concurrent CollectionsLesson 1252Synchronized Wrappers vs Concurrent CollectionsLesson 1305What Is Fail-Safe Behavior?
ConcurrentHashMap
uses lock striping: it divides the map into segments, allowing multiple threads to operate on different segments simultaneously.
Lesson 1166When to Use ConcurrentHashMap vs Synchronized HashMapLesson 1577Custom Map Types with groupingBy Supplier
ConcurrentModificationException
Iterators detect mid-operation changes
Lesson 1247Why Collections Need Synchronization
Condition check
– Tests whether to enter/continue the loop
Lesson 166Executing for Loops: Step-by-Step Evaluation Order
Conditional Logic
You can conditionally add filters based on runtime conditions, building the pipeline dynamically.
Lesson 1481Composing Multiple filter OperationsLesson 2579Thread.currentThread() for Self- ReferenceLesson 2625Checking Daemon Status
Conditional traversal
skip directories based on runtime logic
Lesson 2089Files.walkFileTree for Complex Traversals
Configure queue sizes
Control memory usage and backpressure
Lesson 2866Why Custom Executors Matter: Isolation and Resource Control
Connection failures
The database server is unreachable, credentials are wrong, or the database doesn't exist
Lesson 806SQLException: Database Access Errors
Connection pool depletion
Database connections remain "borrowed" but idle, preventing other parts of your application from accessing the database.
Lesson 848The Problem of Resource Leaks
Consider alternatives
JSON, Protocol Buffers, or custom formats give you more control and are generally safer than native serialization.
Lesson 2166Best Practices for Safe Serialization
Consider data characteristics
If your collection is already mostly sorted, Timsort shines.
Lesson 1364Sorting Performance Considerations
Consider locale implications
Numbers formatted with `String.
Lesson 2233Common Formatting Patterns and Pitfalls
Consider the "final" keyword
Mark methods `final` when subclasses shouldn't override them, even if they're `public` or `protected`.
Lesson 721Access Control Strategy in Inheritance Hierarchies
Consider visibility carefully
make nested classes `private` when possible
Lesson 621Common Use Cases and Best Practices
Consistency hashCode
Equal objects have equal hash codes: `p1.
Lesson 1093Testing Your equals and hashCode Implementations
Consistent behavior
Iteration order (or lack thereof) matches the underlying hash table
Lesson 1053HashSet Iterator: Iterating HashMap Keys
Consistent with mathematical convention
– the sum of an empty set is the additive identity (zero)
Lesson 1594Handling Empty Streams with Summing and Averaging Collectors
Constant memory footprint
Only one line exists in memory at any moment
Lesson 2014Processing Large Files with readLine
Constant values
– Listed in uppercase by convention, separated by commas
Lesson 579Basic Enum Declaration Syntax
Constant-Time Operations
HashSet provides O(1) average-time complexity for:
Lesson 993HashSet: Unique Elements with Hashing
Constraint violations
Inserting duplicate keys or violating foreign key rules
Lesson 806SQLException: Database Access Errors
Constructor body
(the code inside the constructor you called)
Lesson 354Complete Initialization Sequence: Fields, Blocks, Constructor
Constructor execution
The constructor runs, initializing the object's fields
Lesson 313Creating Objects: Using new with Constructors
Constructor logic
You need initialization code (though lambdas can't have constructors anyway)
Lesson 649When to Prefer Lambdas Over Anonymous Classes
Constructors are necessary
You need to initialize common state when objects are created
Lesson 532Decision Criteria: A Practical Checklist
Consumer Super
If a collection is *consuming* values you provide (you're putting items *in*), use `<?
Lesson 939The PECS Principle: Producer Extends, Consumer Super
Container deployments
(smaller Docker images)
Lesson 2552Comparing jlink Images to Traditional Deployments
Contains checks fail
You add an object, then immediately call `contains()` with an equal object, and it returns `false`.
Lesson 558HashSet Breakage: The Same Root Cause
Content extraction
Filter lines matching specific criteria
Lesson 2224Combining lines with Stream Operations
Context Objects
Instead of `ThreadLocal`, pass a context object through your call chain.
Lesson 2641ThreadLocal Alternatives and When to Avoid It
Continues until
either a handler is found or the stack is exhausted
Lesson 751The Search for a Handler
Control
Enforce specific thread counts or queueing behavior
Lesson 2790Providing a Custom Executor to supplyAsync
Control access
Decide who can read or write each field
Lesson 723Prefer private Fields with Controlled Public Methods
Control resource allocation
Dedicate a specific number of threads to side-effect operations
Lesson 2791Providing a Custom Executor to runAsync
Control thread count
Prevent resource exhaustion by capping threads for specific workloads
Lesson 2866Why Custom Executors Matter: Isolation and Resource Control
Control your API surface
keep implementation packages hidden from general consumers
Lesson 2483Qualified exports: Restricting Access to Specific Modules
Convention
All Java developers recognize this syntax instantly
Lesson 96Increment and Decrement Operators: ++ and --
Conversion
`d` (integer), `f` (floating-point), `e` (scientific notation)
Lesson 2228Formatting Numbers with Precision
Conversion or transformation
operations that work across types
Lesson 870Generic Static Methods: Utility Method Patterns
Convert the leaves first
by adding `module-info.
Lesson 2526The Bottom-Up Migration Strategy
Convert to bucket index
`HashMap` takes that hash code and performs a calculation (typically involving modulo arithmetic with the array size) to convert it into a valid array index.
Lesson 554How HashMap Uses hashCode for Bucket Selection
Convert types
Transform primitives, Strings, and nested objects into the target format
Lesson 2389Serialization and Object Persistence
Coordinating with other I/O
When writing to logs or synchronizing with external systems
Lesson 1985flush: Forcing Buffer Contents to Disk
Coordinating with other processes
If another program is reading the file you're writing, flushing ensures they see your latest updates.
Lesson 1957flush() and When to Use It
Correctness
Non-ASCII characters (like emoji, accented letters, or other languages) are preserved
Lesson 2044Character Encoding and Charset Parameters
Costly upstream operations
If `map()` or `filter()` precedes `skip()`, those transformations run on discarded elements too
Lesson 1469Performance Implications of skip
Counts
Abstract methods with no implementation in `Object`
Lesson 1627Object Class Methods Don't Count
Counts abstract methods
(excluding `default` methods, `static` methods, and methods from `Object`)
Lesson 1633Compiler Validation of Single Abstract Method
covariant
, which means if `Dog` is a subtype of `Animal`, then `Dog[]` is considered a subtype of `Animal[]`.
Lesson 448Upcasting and Downcasting with ArraysLesson 897Cannot Create Generic ArraysLesson 1500Common Pitfalls with toArray(Object[]::new)
Covariant returns are safe
because the caller expects at least the superclass return type.
Lesson 476Covariance vs Parameter Contravariance
CPU caching
Each processor core caches frequently-used values locally
Lesson 2680The Visibility Problem: Why volatile Exists
CPU release
The thread scheduler removes this thread from active consideration—it won't get CPU time until the sleep duration expires
Lesson 2592What Happens During sleep: Thread State Changes
CPU usage
Near zero for the affected threads
Lesson 2703Detecting Livelock vs Deadlock
CPU-intensive tasks
→ Pool matching CPU core count
Lesson 2866Why Custom Executors Matter: Isolation and Resource Control
Craft a stream
declaring it contains a malicious class that implements `Serializable`
Lesson 2161Type Confusion and Class Substitution
Create a constructor
to initialize the field
Lesson 587Declaring Fields in Enums
Create a new array
with double the capacity (old capacity × 2)
Lesson 1126The Rehashing Process: Doubling Capacity
Create a new class
for the evolved version
Lesson 2164Versioning Problems and Class Evolution
Create a new node
containing your data, with `prev` set to `null` and `next` pointing to the current head
Lesson 1022Adding Elements to the BeginningLesson 1023Adding Elements to the End
Create multiple specialized versions
from a single generic class definition
Lesson 858Instantiating Generic Classes with Type Arguments
Create on demand
If all threads are busy, a **new thread is created** to handle the task
Lesson 2723newCachedThreadPool: Elastic Thread Pool for Short Tasks
Create the exception object
– This includes allocating memory like any other object
Lesson 755Performance Impact of Unwinding
Creates the target file
if it doesn't exist
Lesson 2055Files.copy: Basic File Copying
Credit card numbers
`long` (16 digits exceed `int` range)
Lesson 36Choosing the Right Integer Type for Your Data
Critical business logic
→ Dedicated pool with guaranteed resources
Lesson 2866Why Custom Executors Matter: Isolation and Resource Control
Critical checkpoints
When writing log files, you might want to flush after every critical error message so the information is preserved even if your program crashes immediately after.
Lesson 1957flush() and When to Use It
Critical data checkpoints
After writing important data that must reach disk immediately (before continuing program logic)
Lesson 1938close vs flush: Automatic Flushing on Close
Critical logic
Methods involved in security, mathematical calculations, or core algorithms that must remain consistent
Lesson 424The final Keyword on Methods
Critical rule
`super()` must be the **first statement** in your subclass constructor, just like `this()`.
Lesson 405The super() Constructor CallLesson 1226Sorting and Searching with Reverse Order
Cross-language compatibility
Protocol Buffers, JSON, and XML work with Python, JavaScript, Go, etc.
Lesson 2165Alternatives to Java Serialization
Cross-platform communication
Need to talk to Python, JavaScript, or other languages?
Lesson 2111When to Use and Avoid Serialization
Cross-platform compatibility
Some operating systems treat file names as case-insensitive (like Windows), which could cause problems if packages differ only by case.
Lesson 680Package Name Case Conventions: All Lowercase
Crucially, `isDone()` returns immediately
it never blocks your thread.
Lesson 2743isDone(): Checking Task Completion Non-Blockingly
Curly braces `{}`
= the cabinet's walls that hold everything together
Lesson 9Anatomy of a Java Source File
Custom collection implementations
Where certain operations make no sense
Lesson 802UnsupportedOperationException in Collections
Custom data structures
require specialized accumulation (like your immutable collection from the previous lesson)
Lesson 1623When to Write Custom Collectors vs Compose Existing Ones
Custom implementations
Some specialized collection classes simply don't support removal for design reasons.
Lesson 1281Why remove() Is Optional and May Throw UnsupportedOperationException
Custom initial capacity
helps when you know roughly how many elements you'll store.
Lesson 1064Custom Initial Capacity and Load Factor
Custom load factor
is a space-time trade-off:
Lesson 1064Custom Initial Capacity and Load Factor
Custom ordering
You provide a `Comparator` at TreeMap creation
Lesson 1135Key Requirements: Comparable or Comparator
Custom thread priorities
(though rarely needed)
Lesson 2728Thread Naming and Daemon Status in Factory Methods
Cycling through ranges
`index % arrayLength` wraps values
Lesson 88The Modulus Operator: Finding Remainders

D

daemon thread
is a low-priority background thread that provides services to user threads.
Lesson 2618What Are Daemon Threads?Lesson 2619User Threads vs Daemon Threads
Dagger
uses annotations like `@Inject`, `@Component`, and `@Module` to generate dependency injection code.
Lesson 2459Common Use Cases: Lombok, AutoValue, and Dagger
Dagger/Hilt
Generates dependency injection code
Lesson 2452What Are Annotation Processors?
Data aggregation
Fetching user data from multiple microservices where each service provides different information (profile, orders, preferences)
Lesson 2767Use Cases: invokeAll vs invokeAny
Data cleaning
Remove comments or blank lines from configuration files
Lesson 2224Combining lines with Stream Operations
Data corruption
You might set fields to invalid values the class never expected
Lesson 2360Performance and Security Implications of Field Access
Data integrity
where partial writes would cause corruption
Lesson 2052Atomic Writes and File Creation Guarantees
Database connections
Return connections to the pool or close them entirely.
Lesson 734Common finally Use Cases: Resource CleanupLesson 2136Use Case: Non-Serializable References
Deadlines
"Submit by December 31st" refers to the calendar date
Lesson 1836LocalDate: Representing Dates Without Time
Declaration
means you're announcing that a variable exists and what type of data it will hold.
Lesson 243Array Declaration vs InstantiationLesson 825Implementing AutoCloseable
Declarative
You describe the transformation steps, not how to loop and mutate data
Lesson 1480Understanding the Pipeline Pattern
Declare explicit parameter types
in the lambda itself
Lesson 1715Inference Limitations and Ambiguity
Declare it
in your method signature with `throws InterruptedException`
Lesson 2593InterruptedException: A Checked Exception
Declare the field
as you would in any class (usually `private final`)
Lesson 587Declaring Fields in Enums
Declared it
in your method signature using `throws`
Lesson 787Compile-Time Enforcement of Checked Exceptions
Declaring
a variable means telling Java "I need a box to store an integer, and I'm going to call it this name.
Lesson 27Declaring and Initializing int Variables
Declaring fewer exceptions
from the superclass's list
Lesson 421Checked Exceptions in Overriding Methods
Declaring no exceptions
(even if the superclass method declares some)
Lesson 421Checked Exceptions in Overriding Methods
Decode
bytes back into characters (reading)
Lesson 1997What Is Character Encoding?
Decoupling
Consumer modules don't need compile-time dependencies on providers
Lesson 2499The java.util.ServiceLoader ClassLesson 2713Task Queues: Buffering Work for Thread Pools
Dedicated lock
Production code, public APIs, libraries, or whenever external synchronization might occur
Lesson 2664Synchronized on this vs Dedicated Lock Objects
Dedicated threads
for critical tasks to avoid contention with other operations
Lesson 2790Providing a Custom Executor to supplyAsync
Deduplicated identifiers
in data processing where the same values repeat often
Lesson 2184Common Use Cases and Anti-patterns
Deep cloning
Creating exact copies of complex object graphs is straightforward with serialization (serialize then deserialize).
Lesson 2111When to Use and Avoid Serialization
default access
, meaning it's only visible to other classes **within the same package**.
Lesson 694Class-Level Access Modifiers OverviewLesson 696Package-Private Classes (Default Access)
Default to `private`
for all fields and most methods
Lesson 337The Principle of Least Privilege
Default to `StringBuilder`
In the vast majority of scenarios, `StringBuilder` is the right choice.
Lesson 2194When to Use StringBuilder vs StringBuffer
Default value providers
Supplying fresh instances
Lesson 1747Constructor References with No Arguments
Defensive copying
creates a brand-new, independent collection containing copies of the original elements.
Lesson 1245Defensive Copying vs Unmodifiable ViewsLesson 2172Defensive Copying Is Unnecessary
Defer work
Store items and handle the most recent one first (like function call stacks)
Lesson 1218Stack vs Queue Trade-offs in Problem Solving
Define a service interface
in one module (e.
Lesson 2498The Service Provider Interface (SPI) Pattern
Define the `compareTo` method
with your comparison logic
Lesson 1311Implementing Comparable in a Custom Class
Delegate
to a preferred default while adding your own behavior
Lesson 500Using super to Call Specific Default Method
Deleting fields
Old data contains fields the new class doesn't expect
Lesson 2126Compatible vs Incompatible Class Changes
Demonstration and learning
When teaching concurrency, `Thread.
Lesson 2590The Purpose of Thread.sleep
Dependency Injection (Spring, CDI)
Lesson 2439Use Cases for RUNTIME Retention
Dependency injection frameworks
(Spring, CDI) require constructor and field access
Lesson 2492Unconditional opens: Opening Packages to All Modules
Dependency Inversion Principle
the sorting algorithms depend on the `Comparable` abstraction, not on specific class details.
Lesson 1315Sorting with Collections.sort and Arrays.sort
Derived fields
Recalculate values based on other fields (e.
Lesson 2138Restoring transient Fields on Deserialization
Derived or computed
cached calculations you can regenerate
Lesson 2132Marking Fields as transient
Describes content, not structure
Use `com.
Lesson 683Best Practices: Meaningful Package Names
Design intent
Some classes represent complete, immutable concepts that shouldn't be specialized.
Lesson 427The final Keyword on Classes
Design principle
Refactor your code so each operation needs only one lock.
Lesson 2699Avoiding Nested Locks and Minimizing Lock Scope
Detect failure
if the lock isn't available in time
Lesson 2698Timeouts and tryLock: Breaking Potential Deadlocks
Detection difficulty
With two threads, you might notice the hang quickly.
Lesson 2694Deadlock with Multiple Threads and Resources
Determine the minimum
The smallest indentation among all lines (including the closing delimiter)
Lesson 2237Indentation Removal Algorithm
deterministic
cleanup happens exactly when the try block ends, not at some unknown future time.
Lesson 576Modern Alternatives to finalizeLesson 1542findFirst: Deterministic Element Selection
Deterministic Output
When running tests or generating reports, you want consistent, predictable results.
Lesson 1081Use Cases for Insertion Order
Devirtualization
If the JIT determines only one implementation is ever used at a call site, it replaces dynamic dispatch with a direct call
Lesson 468Performance Implications of Dynamic Dispatch
Different neighborhood
Only blood relatives (subclasses) can visit
Lesson 706Protected Members and Package Boundaries
Different package
Package-private members are invisible, period
Lesson 704Package-Private (Default) Access Across Packages
Different pool sizes
optimized for your workload (CPU-bound vs I/O-bound)
Lesson 2790Providing a Custom Executor to supplyAsync
Diminishing returns
as buffer size increases?
Lesson 1958Profiling I/O Performance: Identifying Bottlenecks
Direct buffer operations
Transfer data with less copying between user and kernel space
Lesson 1955File Channel and Memory-Mapped I/O Preview
Direct index calculation
The hash code instantly tells you which bucket to check (math operation, not a search)
Lesson 1112Performance Characteristics: O(1) Average Case
Direct invocation
Methods like `invokeExact()` and `invoke()` provide faster dispatch mechanisms than traditional reflection.
Lesson 2403MethodHandles as a Faster Alternative
Directories must be empty
You cannot delete a directory containing files or subdirectories
Lesson 2060Files.delete: Deleting Files and Directories
Discard
the old array (garbage collected)
Lesson 1008System.arraycopy: The Reallocation Mechanism
Discover fields
Call `getDeclaredFields()` to find all properties
Lesson 2389Serialization and Object Persistence
Distributed computation
Splitting a large dataset across workers, then combining all partial results
Lesson 2767Use Cases: invokeAll vs invokeAny
Distributed systems (same codebase)
When sending objects between JVMs running identical code versions—like in RMI (Remote Method Invocation) or specific clustering scenarios—serialization provides a quick solution.
Lesson 2111When to Use and Avoid Serialization
Division (/)
Divides the left value by the right.
Lesson 86The Five Basic Arithmetic Operators: +, -, *, /, %
Do all elements match
**Do none of the elements match?
Lesson 1532Understanding Match Operations Overview
Do any elements match
**Do all elements match?
Lesson 1532Understanding Match Operations Overview
Document assumptions
Make time zone choices explicit in comments
Lesson 1902Interoperating with Legacy APIs
Document clearly
If you're returning a synchronized collection from a method, document it so callers don't re-wrap it
Lesson 1253Nested Synchronized Wrapper Anti-Pattern
Document close() behavior clearly
If your `close()` method can throw specific exceptions, document when and why, so callers can decide whether to check suppressed exceptions.
Lesson 847Best Practices for Suppressed Exceptions
Document each flag
with a comment explaining why it's needed
Lesson 2530Using --add-exports and --add-opens as Temporary Workarounds
Document intended inheritance
Use comments to clarify which methods subclasses should override and which they should just call.
Lesson 721Access Control Strategy in Inheritance Hierarchies
Document temporary workarounds
Track which dependencies remain automatic
Lesson 2543Migration Strategy: From Automatic to Explicit Modules
Document your public API
What's `public` is your contract with other developers
Lesson 712Cross-Package Access Patterns and Best Practices
Documentation
It explicitly tells other developers (and your future self) that this interface is designed to work with lambdas
Lesson 1634Using @FunctionalInterface on Custom Interfaces
Documentation generation
like JavaDoc tags
Lesson 2434RetentionPolicy.SOURCE Explained
Documentation suffers
The relationship between components isn't visible in the code structure
Lesson 2396Maintaining Code with Reflection
does not
change or override Java's access control rules—visibility is still governed by access modifiers alone.
Lesson 711Import Statements Do Not Grant AccessLesson 1864Period Arithmetic and Normalization
Does NOT change modCount
`get()`, `set()`, `contains()`, `size()` (these aren't structural changes)
Lesson 1301The modCount Field in ArrayList
Does NOT include
private, protected, or package-private methods
Lesson 2333Getting Methods with getMethods()
Doesn't count
`equals()`, `hashCode()`, `toString()`, `getClass()`, `notify()`, etc.
Lesson 1627Object Class Methods Don't Count
Domain-specific errors need identification
An `InsufficientFundsException` tells you more than a generic `IllegalStateException`
Lesson 821Best Practices: Avoiding Exception Overuse
Don't assume single-round processing
your processor may run multiple times.
Lesson 2460Debugging Annotation Processors
Don't implement `Comparable` if
Lesson 1318When Not to Use Comparable
Double-ended queue operations
Adding/removing from both ends efficiently
Lesson 980ArrayList vs LinkedList: Access Patterns Matter
Downcasting
is the reverse operation: you explicitly cast a superclass reference back to a subclass type to regain access to those subclass-specific features.
Lesson 443What is Downcasting?
Download
Visit the JDK provider's website (Oracle or Adoptium for OpenJDK) and download the Windows `.
Lesson 4Installing the JDK on Your Operating System
DTO mapping
, **factory methods**, and **collecting stream results**.
Lesson 1753Common Patterns and Use Cases
Dual functionality
If you need both queue operations (offer, poll, peek) AND list operations (add at specific index, get by position) on the same data structure, `LinkedList` is your only option that implements both interfaces.
Lesson 1180When to Use LinkedList as a Queue
Duplicate detection
Check if `frequency() > 1`
Lesson 1264Collections.frequency: Counting Element Occurrences
Duplicate elements appear
The set can contain what *should be* duplicates because different hash codes send "equal" objects to different buckets.
Lesson 558HashSet Breakage: The Same Root Cause
Duplicates Allowed
You can add the same element multiple times:
Lesson 969List Interface: Ordered Collections with Duplicates
Duration
works with **time-based types** (those containing time components):
Lesson 1865Adding Duration and Period to Temporal Objects
During `sleep()` call
Thread immediately transitions to `TIMED_WAITING` state
Lesson 2592What Happens During sleep: Thread State Changes
dynamic binding
(also called runtime polymorphism): Java decides *which version* of an overridden method to call based on the actual object type at runtime.
Lesson 422static Methods Cannot Be OverriddenLesson 463Static vs Dynamic Binding
Dynamic instantiation
Creating objects without compile-time knowledge of the type
Lesson 2320What is the Class Object?
Dynamic Resizing
No need to declare size upfront.
Lesson 989ArrayList: Dynamic Array Fundamentals

E

Early exit
It immediately terminates the method, even if there's more code below
Lesson 196The return Statement: Early Exit and Value Propagation
Early return
even if `try` or `catch` contains a `return` statement, `finally` executes first
Lesson 733The finally Block: Guaranteed Execution
Eases debugging
Smaller scope means fewer places where things can go wrong
Lesson 193Best Practices for Variable Scope
Easier reasoning
the object's state at construction is its state forever
Lesson 727Immutability and final: Defensive Access Control
Efficiency
You avoid unnecessary computations.
Lesson 140Short-Circuit Evaluation: Efficiency and Safety
Efficient with expensive sources
If reading elements is costly (database queries, network calls), `limit()` prevents fetching more than necessary.
Lesson 1414Intermediate Short-Circuiting: limit Operation
Either or both false
→ Result is `false`
Lesson 107Logical AND Operator: &&
Elegant
Works for any distance (positive or negative) after normalizing
Lesson 1236Rotate Internals: Reversal Algorithm
Element modification
Not just remove elements—you can replace them or insert new ones at the current position.
Lesson 1282The ListIterator Interface Overview
Eliminate casting
No need to cast objects when retrieving them
Lesson 858Instantiating Generic Classes with Type Arguments
Eliminate casts
Because the compiler knows the type, you don't need manual casts when retrieving elements.
Lesson 855What Are Generics and Why They Matter
Eliminates creation overhead
Threads are created once
Lesson 2712Thread Pools: Reusing Threads for Efficiency
Email addresses
Must follow a complete email format
Lesson 2260When to Use matches(): Input Validation and Format Checking
Email validation
Ensuring input looks like a complete email address
Lesson 2256Using matches() for Full String Validation
Emphasizing Origin
Sometimes the package name adds important context.
Lesson 678When to Use FQNs vs Import Statements
Empty arrays
Forgetting that a zero-length array has no valid indices at all
Lesson 245ArrayIndexOutOfBoundsException and Bounds Checking
Empty line
→ `readLine()` returns `""` (an empty `String` object)
Lesson 2013Empty Lines and readLine Behavior
Enable framework/library cooperation
without polluting the public API
Lesson 2483Qualified exports: Restricting Access to Specific Modules
Enables chaining
combine multiple comparison criteria fluently (you'll learn this soon)
Lesson 1337Introduction to Comparator Factory Methods
Encapsulation boundaries
where only the outer class and its inner helper can see certain implementation details
Lesson 630Inner Classes and Encapsulation
Encapsulation is preserved
Implementation details stay hidden
Lesson 523Visibility Rules: Private Methods Cannot Be Overridden
Encode
characters into bytes (writing)
Lesson 1997What Is Character Encoding?
Encoding-aware
Automatically handles character encoding conversion
Lesson 1959The Reader Hierarchy: Character-Based Input
End of file
→ `readLine()` returns `null` (no more data to read)
Lesson 2013Empty Lines and readLine Behavior
Enforces
strong encapsulation based on `exports` declarations
Lesson 2476The Readability Graph
Entry point gadget
A class whose `readObject()` calls methods on other objects
Lesson 2159Gadget Chains and Object Injection
enum
(enumeration) is a special Java type that defines a fixed set of named constants.
Lesson 578What Are Enums and Why They MatterLesson 579Basic Enum Declaration Syntax
Enum name
– Follows standard naming conventions (capitalize first letter)
Lesson 579Basic Enum Declaration Syntax
EnumMap
knows its keys are enums from a fixed, predefined set.
Lesson 601Introduction to EnumMap: A Specialized Map for Enum Keys
Environment-specific
thread references, database connections, file handles
Lesson 2132Marking Fields as transient
EOF detection
Reading past the last object throws `EOFException`
Lesson 2115Serializing Multiple Objects in Sequence
Error checking
`errorRaised()` indicates if errors occurred in previous rounds
Lesson 2457The RoundEnvironment and Processing Rounds
Error type
`';' expected` (you forgot a semicolon)
Lesson 14Understanding Compilation Errors
Error-prone
You might mistype the cast or variable name
Lesson 452The Boilerplate Problem: Test-Cast-Use Pattern
escape sequence
is a backslash (`\`) followed by a special character code.
Lesson 49Character Literals and Escape SequencesLesson 61String Literals and Escape Characters
Event handling
React to multiple events (network messages, timers, user actions) concurrently without blocking other parts of your application.
Lesson 2560When to Use Threads in Java
Event processors
monitoring a queue until shutdown
Lesson 169Omitting for Loop Components: Infinite Loops
Event Scheduling
Storing time slots where you need to find the next available slot after a given time (`ceiling()`) or the last slot before a deadline (`floor()`).
Lesson 1101TreeSet as NavigableSet: Practical Applications
Event simulation
where events must be processed by timestamp rather than insertion order
Lesson 1183What Is a PriorityQueue?
Eventual failure
Your application crashes or becomes unresponsive.
Lesson 848The Problem of Resource Leaks
Eventual release
Only when all nested synchronized contexts complete does the lock become available
Lesson 2674Lock Acquisition Count: Entry and Exit Tracking
Eventually become false
(preventing infinite loops)
Lesson 157Writing Effective while Loop Conditions
Every nth item
`counter % n == 0` triggers every n iterations
Lesson 88The Modulus Operator: Finding Remainders
Every single operation
in Vector—`add()`, `get()`, `size()`—acquires and releases a lock.
Lesson 1031Vector vs ArrayList: Key Differences
Every single time
you override a method, type `@Override` on the line above it.
Lesson 423Best Practices: Always Use @OverrideLesson 1790Common Pitfalls with orElse Family Methods
Exact matches
with fixed parameters first
Lesson 220Method Overloading with Varargs
exactly one parameter
, Java lets you omit the parentheses around that parameter.
Lesson 1700Single Parameter Lambda: Parentheses OptionalLesson 1716Parentheses Rules for Single Parameters
exactly the same signature
(name, parameters, and return type), there's no conflict at all.
Lesson 498Interface Method Name ConflictsLesson 964Cannot Overload Methods Differing Only by Type Parameters
Examines each entry
in the bucket (traversing linked lists or tree bins)
Lesson 1128Recalculating Hash Indices After Resizing
Example mental model
Think of a hash table as a filing cabinet with random drawers—lightning-fast access, but no inherent organization.
Lesson 982HashMap vs TreeMap: When Sorted Keys Are Worth the Cost
Example of violation
Imagine comparing `Person` objects where you return results based on random coin flips, or switching comparison criteria inconsistently.
Lesson 1321Transitivity: If A > B and B > C, Then A > C
Example scenarios
Handling thousands of brief I/O callbacks, processing sporadic user events, or managing websocket messages.
Lesson 2725When to Use newCachedThreadPool vs newFixedThreadPool
Example with TreeMap
(sorted alphabetically by first letter):
Lesson 1577Custom Map Types with groupingBy Supplier
Exception
– Should declare `throws IOException`
Lesson 2140The writeObject Method Signature
Exception handling dilemma
If both the main code and `close()` throw exceptions, which one do you report?
Lesson 850The Classic finally Block Pattern
Exception is caught
code throws, jumps to matching `catch`, then runs `finally`
Lesson 733The finally Block: Guaranteed Execution
Exception is not caught
code throws, no matching `catch` exists, but `finally` still runs before propagating the exception upward
Lesson 733The finally Block: Guaranteed Execution
Exception is thrown
in a method
Lesson 751The Search for a Handler
Exception propagation
If the original future fails, `thenApply` never executes
Lesson 2797What thenApply Does: Synchronous Transformation
Exception style
If someone asks for a table when the list is full, the host loudly announces "We're full!
Lesson 1171Exception-Throwing vs Returning-Special-Value Methods
Exception swallowing
Exceptions in `finalize()` are ignored silently
Lesson 574The finalize Method: Legacy Cleanup Mechanism
Exception type
What kind of exception it catches (e.
Lesson 730The catch Block: Handling Specific Exception Types
Exception wrapping
– packaging any constructor exceptions into `InvocationTargetException`
Lesson 2378Performance and Security Considerations
Exception Wrapping Issues
It throws checked exceptions directly from constructors, rather than wrapping them in `InvocationTargetException`.
Lesson 2374Using Class.newInstance() and Its Deprecation
Exception-throwing
"I *must* get $50 or I want the machine to shout at me!
Lesson 1178Exception-Throwing vs Null-Returning Methods
Exchange data
across systems where the offset matters but zone rules don't
Lesson 1867Introduction to OffsetDateTime
Execution triggers
All those lazy intermediate operations you chained together finally run
Lesson 1488Understanding forEach as a Terminal Operation
Exhaustiveness
means accounting for every possible value your variable might have.
Lesson 146The default Case and Exhaustiveness
Exits `methodC()`
immediately, abandoning any remaining code in that method
Lesson 750Exception-Driven Stack Unwinding
explicit
about parameter types by declaring them yourself: `(Integer x, Integer y) -> x + y`.
Lesson 1706Parameter Type Declaration: Explicit TypesLesson 2475Platform Modules: Requiring JDK Modules
explicit casting
you must tell Java you understand the risk of data loss:
Lesson 202Return Type Compatibility and CastingLesson 1732Ambiguity and Overload Resolution
Explicit mismatch
Both versions declare `serialVersionUID`, but with different values
Lesson 2125InvalidClassException: Version Mismatch Errors
Explicit module
You control visibility with `exports com.
Lesson 2539Automatic Modules Export All Packages
Explicit versioning
Schema evolution is built-in and controlled
Lesson 2165Alternatives to Java Serialization
explicitly
call `super()` with arguments to invoke a *specific* superclass constructor.
Lesson 405The super() Constructor CallLesson 2468Module Descriptors and Accessibility Rules
Explicitness
Each command shows exactly which classpath it uses
Lesson 691The CLASSPATH Environment Variable
Exported packages remain exported
via `exports` directives
Lesson 2494Open Modules: Making All Packages Reflectively Accessible
Exporting all packages
to other modules automatically
Lesson 2535What Are Automatic Modules?
Exports everything
All packages are implicitly exported
Lesson 2515Modular JARs vs Non-Modular JARs at Runtime
Exports everything to itself
All packages in the unnamed module are accessible to other classpath code
Lesson 2469Unnamed Modules and Compatibility
Expose internals selectively
for testing or tight integration without making them fully public
Lesson 2483Qualified exports: Restricting Access to Specific Modules
Exposes Vector methods
Because `Stack` extends `Vector`, you can accidentally access elements by index or insert in the middle, breaking the LIFO (Last-In-First-Out) contract that stacks should enforce.
Lesson 1211Why Deque Is Preferred Over Stack Class
Extending classes
Lambdas only work with interfaces, not class extension
Lesson 649When to Prefer Lambdas Over Anonymous Classes
External resources
Any resource obtained from outside your Java program (system handles, native memory) needs explicit cleanup.
Lesson 734Common finally Use Cases: Resource Cleanup
External service calls
Network requests that might hang
Lesson 2742get() with Timeout: Avoiding Indefinite Blocking
Externalizable
You rapidly throw items in according to your own efficient system—no questions asked.
Lesson 2153Performance Benefits of Externalizable
Extra memory
Each entry stores two additional references (previous and next nodes)
Lesson 1079Performance Characteristics
Extra object overhead
Each node carries pointer references
Lesson 1227Performance Characteristics of Sorting
Extra pointer updates
Adding an element requires updating linked list pointers (making the new node the tail)
Lesson 1079Performance Characteristics
Extra unlinking
Removing an element requires adjusting two pointers to bypass the removed node
Lesson 1079Performance Characteristics
Extract
(if using archive): Unpack to a directory like `/opt/jdk-[version]`
Lesson 4Installing the JDK on Your Operating System
Extracting properties
Getting unique ages, departments, or categories from objects
Lesson 1483Using distinct After Transformations

F

factory
is a design pattern that centralizes object creation logic.
Lesson 1670Suppliers for Factory PatternsLesson 2719The Executors Factory Class Overview
Factory patterns
Creating objects on demand
Lesson 1747Constructor References with No Arguments
fail-fast
iterators that immediately throw `ConcurrentModificationException` when they detect structural modifications during iteration.
Lesson 1305What Is Fail-Safe Behavior?Lesson 1307ConcurrentHashMap and Weakly Consistent IteratorsLesson 1308Choosing Fail-Fast vs Fail-Safe
Fail-fast collections
offer better performance in single-threaded or well-synchronized contexts.
Lesson 1308Choosing Fail-Fast vs Fail-Safe
Fail-fast scenarios
Better to timeout and retry than wait forever
Lesson 2742get() with Timeout: Avoiding Indefinite Blocking
Fail-safe
iterators take the opposite approach: they work on a **copy or snapshot** of the collection's data, so changes to the original collection don't affect the iteration in progress.
Lesson 1305What Is Fail-Safe Behavior?Lesson 1308Choosing Fail-Fast vs Fail-Safe
Fail-safe collections
handle concurrency automatically but at a cost:
Lesson 1308Choosing Fail-Fast vs Fail-Safe
Fails `contains()` checks
Searching for an object looks in the wrong bucket because the hash code doesn't match what was used during insertion
Lesson 1086Breaking HashSet with Bad hashCode
Fairness guarantees
Ensuring no item "cuts in line"
Lesson 1218Stack vs Queue Trade-offs in Problem Solving
Fall back
to a default value or alternative approach
Lesson 2754Timeout-Based Result Retrieval with get(timeout)
Fast deletions
Remove pairs by key in constant time
Lesson 997HashMap: Key-Value Pairs with Hashing
Fast insertions
Add new key-value pairs in constant time
Lesson 997HashMap: Key-Value Pairs with Hashing
Fast lookups
Find values by key in constant time
Lesson 997HashMap: Key-Value Pairs with Hashing
Fast Random Access
Need the element at index 500?
Lesson 989ArrayList: Dynamic Array Fundamentals
Favor package-private over protected
Only use `protected` when inheritance-based extension is truly needed
Lesson 712Cross-Package Access Patterns and Best Practices
Fewer resizes needed
as the collection grows large
Lesson 1033Vector Growth Strategy: Doubling Capacity
Fewer Resources to Save
A thread context switch only needs to save and restore:
Lesson 2559Context Switching Costs
Field initializers
(in declaration order, top to bottom)
Lesson 354Complete Initialization Sequence: Fields, Blocks, Constructor
Field initializers execute first
, then the constructor body runs.
Lesson 351Order of Initialization: Fields Before Constructor Body
FIFO discipline
processing items in order from front to back.
Lesson 1177Queue vs List Methods on LinkedList
FIFO semantics
(first-in, first-out).
Lesson 1170Queue vs List: When to Use Each
File and line number
`HelloWorld.
Lesson 14Understanding Compilation Errors
File handles
– point to system resources that may not exist later
Lesson 2136Use Case: Non-Serializable References
File handling
Close file readers/writers to release operating system handles.
Lesson 734Common finally Use Cases: Resource Cleanup
File locking
Coordinate access across multiple processes
Lesson 1955File Channel and Memory-Mapped I/O Preview
File locks
On some systems, unclosed output streams prevent other processes from reading the file
Lesson 1942Why Closing Streams Matters: Resource Leaks Explained
File locks persist
, preventing deletion or modification by other processes
Lesson 1911The close() Method and Stream Lifecycle
File objects
when you need file metadata or path manipulation.
Lesson 1969Creating FileReader Instances with File Paths
File operations
If a file doesn't exist (`FileNotFoundException`), the caller might prompt the user for a different filename, create the file, or use a default.
Lesson 789When to Use Checked Exceptions: Recoverable Conditions
File streams
The operating system might buffer more data than `available()` reports
Lesson 1909The available() Method and Stream Availability
File tree walking
is the process of systematically visiting every file and directory in a tree structure, starting from a root directory and recursively exploring all branches.
Lesson 2084Introduction to File Tree Walking
FileDescriptor
only in specialized scenarios involving system-level file handles.
Lesson 1969Creating FileReader Instances with File Paths
FileNotFoundException
if the file doesn't exist → log an error, use default data
Lesson 756The Need for Multiple catch Blocks
Files are small
(typically under a few megabytes)
Lesson 2048Memory Considerations When Reading Entire Files
Files.readAllLines()
is like loading an entire grocery list into your shopping cart at once—quick and convenient, but your cart needs to fit everything.
Lesson 2015Alternative: Files.readAllLines vs readLine Loop
Files.readAttributes()
lets you *read* file metadata, NIO.
Lesson 2073Files.setAttribute() and Files.setLastModifiedTime()
Filter before map
means fewer transformations:
Lesson 1482Combining map and filter
Filter early
Apply filters before collecting to avoid processing unnecessary paths
Lesson 2093Performance and Resource Management in Walks
Filter first
Reduce your dataset as soon as possible.
Lesson 1487Operation Order and Performance
Filter object streams
Use `ObjectInputFilter` (Java 9+) or `ValidatingObjectInputStream` to whitelist acceptable classes before deserialization happens.
Lesson 2166Best Practices for Safe Serialization
Final Round
When no new files are generated, a final round occurs with `processingOver()` returning `true`.
Lesson 2457The RoundEnvironment and Processing Rounds
Finally block
runs for additional cleanup
Lesson 835Combining Try-With-Resources and Finally
Financial applications
– More accuracy prevents compounding errors
Lesson 46When to Use double Over float
Finding dependencies is manual
You must search for string literals, which could be concatenated or computed
Lesson 2396Maintaining Code with Reflection
Finding min/max
The collector methods leverage `BinaryOperator.
Lesson 1689Real-World Use Cases: Operators in Stream API
Fine-grained
Small synchronized blocks protecting only the critical section (the actual shared data access).
Lesson 2666Synchronized Block Scope and Granularity
First `awaitTermination()`
waits a reasonable time (adjust 60 seconds to your needs)
Lesson 2775Common Shutdown Patterns and Best Practices
First downstream collector
– computes one result (e.
Lesson 1609Basic teeing Example: Min and Max in One Pass
First traversal
Iterating through the stream to build the list
Lesson 1613Performance Benefits of teeing Over Multiple Passes
First/last access
Quickly retrieve the smallest or largest element/key
Lesson 974SortedSet and SortedMap: Ordered Collections
Fisher-Yates algorithm
(also called the Knuth shuffle), which guarantees uniform distribution—every permutation of your list is equally likely.
Lesson 1231Collections.shuffle: Randomizing List Order
Fix
Make fields `private` and provide controlled access through methods.
Lesson 336Common Access Modifier Mistakes
Fixed offset suffices
Use `OffsetDateTime` when you only need the UTC offset, not full zone rules (DST transitions don't matter).
Lesson 1856Best Practices: When to Use ZonedDateTime
Fixed pool
Bounded resource usage, prevents thread explosion, better for steady loads
Lesson 2865Creating Dedicated Thread Pools for CompletableFuture
Fixed-size collections
Arrays converted to lists that can't grow or shrink
Lesson 802UnsupportedOperationException in Collections
Flags
`-` (left-align), `0` (zero-pad), `+` (show sign), `,` (locale grouping)
Lesson 2228Formatting Numbers with PrecisionLesson 2253Compiling with Flags
Flexibility to change
Non-exported packages are invisible to other modules.
Lesson 2488Best Practices: Minimizing Exported API Surface
Flexibility vs Optimization
A full JDK runs *any* Java application; a `jlink` image runs *only* the modules you included.
Lesson 2552Comparing jlink Images to Traditional Deployments
Flushes buffered data
(writes any pending bytes to disk)
Lesson 1911The close() Method and Stream Lifecycle
Flushes remaining data
`close()` automatically calls `flush()` before releasing resources, ensuring no buffered data is lost.
Lesson 1921Flushing and Closing: flush() and close() Methods
Follow the wizard
Click "Next" through the installation screens, accepting the default installation location (usually `C:\Program Files\Java\jdk-[version]`)
Lesson 4Installing the JDK on Your Operating System
Follows `requires transitive`
edges to include indirect dependencies
Lesson 2476The Readability Graph
For clarity
When the lambda is complex or the context isn't obvious, explicit types make your code self- documenting:
Lesson 1706Parameter Type Declaration: Explicit Types
For consistency
In a team codebase with style guidelines, explicit types might be preferred for uniformity.
Lesson 1706Parameter Type Declaration: Explicit Types
For each entry
, recalculate its bucket index using the new capacity
Lesson 1126The Rehashing Process: Doubling Capacity
For enums
You must either list all enum constants or include a `default` case.
Lesson 151Exhaustiveness in Switch Expressions
For frequently modified lists
, accept some wasted space as the cost of speed.
Lesson 1010Memory Implications of Capacity Management
For infinite streams
, short-circuiting is the difference between a working program and one that hangs forever.
Lesson 1416Performance Benefits of Short-Circuiting
For instance variables
remember that `this` references are fine to capture—lambdas naturally work with the enclosing object's state.
Lesson 1726Best Practices for Variable Capture
For large streams
, short-circuiting can dramatically reduce processing time.
Lesson 1416Performance Benefits of Short-Circuiting
For long-lived lists
that won't grow further, call `trimToSize()` after bulk inserts to reclaim memory.
Lesson 1010Memory Implications of Capacity Management
For multi-threaded applications
, use `ConcurrentHashMap`.
Lesson 1158Migrating from Hashtable to Modern Alternatives
For no-argument methods
, pass nothing (or an empty array):
Lesson 2346Passing Arguments: Varargs and Array Wrapping
For primitive types
(like `int`, `char`): You must include a `default` case, since there are too many values to list individually.
Lesson 151Exhaustiveness in Switch Expressions
For primitives
The *actual data value* is copied.
Lesson 279Assignment Semantics: Primitives vs References
For reference types
The *memory address* (reference) is copied, not the object itself.
Lesson 279Assignment Semantics: Primitives vs References
For regular methods
, pass arguments directly:
Lesson 2346Passing Arguments: Varargs and Array Wrapping
For single-threaded applications
, use `HashMap`.
Lesson 1158Migrating from Hashtable to Modern Alternatives
For single-threaded code
Just use `ArrayList`.
Lesson 1035When Not to Use Vector in Modern Code
For Strings
You must include a `default` case.
Lesson 151Exhaustiveness in Switch Expressions
Forces all concrete subclasses
to provide an implementation
Lesson 480Abstract Method Syntax and Rules
Forgetfulness
It's easy to skip a null check when you're focused on business logic
Lesson 1755Traditional null Checking: Verbose and Error-Prone
Forgetting close() entirely
In the rush of development, programmers sometimes open a resource and simply forget to close it.
Lesson 849Manual close() Calls Are Error-Prone
Forgetting escape sequences
To print a literal `%`, use `%%`.
Lesson 2233Common Formatting Patterns and Pitfalls
Forgetting null checks
If resource initialization fails, your variable might be `null`.
Lesson 849Manual close() Calls Are Error-Prone
Formal parameters
(also called "parameters") are the variables you declare in the method signature.
Lesson 197Method Parameters: Formal vs Actual Parameters
format specifiers
, followed by values to insert at those positions.
Lesson 2019printf and format: Formatted OutputLesson 2227Basic Formatting Syntax
Formatted output
Supports printf-style formatting for precise control
Lesson 2016PrintWriter Overview: Formatted Text Output
Formatting nested structures
XML, JSON, or configuration files
Lesson 2221The indent Method: Adding Leading Whitespace
Forward-Backward Scan
Start at the beginning, move forward until you find something interesting, then scan backward to examine context or related elements.
Lesson 1289Bidirectional Iteration Patterns
Foundation for learning
Once you understand `ArrayList<E>`, other generic collections (`HashMap<K,V>`, `LinkedList<E>`) make immediate sense
Lesson 900ArrayList<E> as the Canonical Generic Collection
Fragile configurations
Missing JARs only surface when code paths execute
Lesson 2516Classpath Mechanics: How the JVM Finds Classes
Framework Dependency
Opening packages couples your design to specific frameworks.
Lesson 2497Security and Design Trade-offs with opens
Framework detection
The JVM's serialization mechanism checks `instanceof Serializable` at runtime—interfaces work perfectly for type checks.
Lesson 530Marker Interfaces vs Empty Abstract Classes
Framework internals
Share utility packages with your framework's companion modules without exposing them publicly.
Lesson 2484Multiple Qualified exports for Fine-Grained Control
Frameworks
Spring's `@Autowired`, JPA's `@Entity`, JAX-RS's `@Path` all use `RUNTIME` retention
Lesson 2438RetentionPolicy.RUNTIME Explained
Freedom to refactor
You can change or remove private methods without breaking any implementing classes
Lesson 523Visibility Rules: Private Methods Cannot Be Overridden
Frequent Insertions and Deletions
Lesson 992LinkedList: When to Use It
Frequent iteration
Looping through all elements is very fast
Lesson 980ArrayList vs LinkedList: Access Patterns Matter
Frequent small operations
The lock overhead becomes significant relative to the actual work
Lesson 1251Performance Implications of Synchronized Wrappers
Full accessibility
The module is opened for reflection to all other modules
Lesson 2536How JARs Become Automatic Modules
fully qualified class name
that is, the complete package path plus the class name.
Lesson 664Running Packaged ClassesLesson 753Stack Trace Information
Fully Qualified Name (FQN)
is the complete, unambiguous name of a class that includes its entire package hierarchy followed by the class name itself.
Lesson 676What Is a Fully Qualified Name (FQN)?
Fully terminated
All tasks completed, no threads active
Lesson 2774isShutdown() and isTerminated() Status Methods
Fusion optimization
The JVM can combine multiple operations into a single pass over the data
Lesson 1406Why Laziness Matters for Performance
Future evolution is private
You control all subclasses and can modify freely
Lesson 532Decision Criteria: A Practical Checklist

G

Game loops
continuously checking input and rendering frames
Lesson 169Omitting for Loop Components: Infinite Loops
Garbage collection pressure
from temporary wrapper objects
Lesson 1388IntStream, LongStream, DoubleStream from Primitive Arrays
gatekeeper
, ensuring only valid data gets stored in your private fields.
Lesson 343Validation Logic in SettersLesson 2468Module Descriptors and Accessibility Rules
Gather
Use `join()` to wait for all threads to complete before processing their collective results
Lesson 2616Common join Patterns: Scatter-Gather
GC behavior
Interned strings now participate in regular heap GC cycles
Lesson 2182Intern Pool Location: PermGen vs Metaspace
General handling
uses broader exception types:
Lesson 764Granular vs General Exception Handling
General-purpose decimal math
– Java expects `double` by default
Lesson 46When to Use double Over float
General-purpose file copying
where file sizes vary
Lesson 1935Default Buffer Size: 8KB Explained
Generating a module name
from the JAR filename (e.
Lesson 2535What Are Automatic Modules?
generic class
is like a template that can hold or operate on different types without knowing in advance what those types will be.
Lesson 856Declaring a Generic Class with a Single Type ParameterLesson 872Generic Constructors
Generic method calls
where type parameters can't be inferred
Lesson 1731Target Type from Cast Expressions
generic static methods
in utility classes where making the entire class generic would be inappropriate or awkward.
Lesson 870Generic Static Methods: Utility Method PatternsLesson 878Static Context and Type Parameters
Generic type `T`
= `Integer` (from the argument `42`)
Lesson 1733Target Typing with Generic Methods
Generic type erasure
At runtime, `ArrayList<String>` and `ArrayList<Integer>` both become just `ArrayList` due to type erasure.
Lesson 960Cannot Create Arrays of Parameterized Types
Generic utilities
Tools that operate on any object type
Lesson 2341Overview of Method.invoke and Its Purpose
Geographic failover
Querying multiple data centers simultaneously and accepting the first response
Lesson 2767Use Cases: invokeAll vs invokeAny
Get compile-time type safety
The compiler prevents you from putting an `Integer` into a `Box<String>`
Lesson 858Instantiating Generic Classes with Type Arguments
Getter/setter protection
when multiple fields must stay consistent
Lesson 2660When to Use Synchronized Methods
Glob patterns
are simple wildcard expressions:
Lesson 2076Filtering Directory Entries with Glob Patterns
Graceful shutdown
(`shutdown()`) is like announcing "no new customers" at a restaurant while letting everyone already seated finish their meals.
Lesson 2768Understanding Graceful vs Immediate Shutdown
Gradual migration
Converting existing code piece-by-piece
Lesson 2032Converting Between Path and File
Gradually migrate dependencies
as they release modular versions or as you have time to modularize them yourself
Lesson 2527The Top-Down Migration Strategy
Granting reflective access
to all packages by default
Lesson 2535What Are Automatic Modules?
Granular handling
means catching specific exception types with targeted responses:
Lesson 764Granular vs General Exception Handling
Graph construction
Build a directed graph where nodes are modules and edges are dependencies
Lesson 2470Module Graph and Dependencies at Runtime
Graphics/game programming
– Some GPU operations prefer `float`
Lesson 46When to Use double Over float
Grids and matrices
`ArrayList<ArrayList<Integer>>`
Lesson 909Collections of Collections: Nested Generics
Group 1
= `((A)(B))` — the outermost parentheses (opens first)
Lesson 2268Nested Groups and Group Numbering
Group 2
= `(A)` — opens second, nested inside group 1
Lesson 2268Nested Groups and Group Numbering
Group 3
= `(B)` — opens third, also nested inside group 1
Lesson 2268Nested Groups and Group Numbering
Group order might change
during refactoring
Lesson 2275Named Groups vs Numbered Groups
Grouped by domain
(arrays, collections, objects, math)
Lesson 392Real-World Examples: Java Standard Library
Grouped data
`ArrayList<HashSet<String>>` for sets of tags per item
Lesson 909Collections of Collections: Nested Generics
Grouping operations
organizing stream elements into categories (like grouping by key)
Lesson 1522Why collect Is the Gateway to Advanced Collectors

H

Handle errors
with callbacks, not just try-catch blocks
Lesson 2777What is CompletableFuture and Why Use It?
Handle exhaustion
Operating systems limit the number of open files or sockets per process.
Lesson 848The Problem of Resource Leaks
Handles empty streams gracefully
If the stream is empty, the result is `0.
Lesson 1590The averagingInt, averagingLong, and averagingDouble Collectors
Handling recurring events
When events repeat based on local time ("every Monday at 10 AM"), regardless of DST changes.
Lesson 1856Best Practices: When to Use ZonedDateTime
Handling requests
where some users or operations have higher priority
Lesson 1183What Is a PriorityQueue?
Hard to defend
You can't easily "sanitize" serialized data without deserializing it first
Lesson 2158Serialization as an Attack Vector
Hash-based lookups
O(1) average case per element
Lesson 1448Performance Implications of distinct on Large Streams
hashing
to organize elements into "buckets," which makes adding, removing, and checking for existence extremely fast.
Lesson 993HashSet: Unique Elements with HashingLesson 997HashMap: Key-Value Pairs with Hashing
HashMap calls `key.hashCode()`
this returns an integer
Lesson 1103Hash Functions and hashCode() in HashMap
HashMap/HashSet
Adding or removing keys/elements
Lesson 1304Fail-Fast in HashMap and Other Collections
HashSet deduplication
Adding equal objects shouldn't increase size
Lesson 1093Testing Your equals and hashCode Implementations
Hashtable
has synchronization baked directly into its methods.
Lesson 1156Thread Safety: Hashtable vs Collections.synchronizedMap
Heap pollution
occurs when a variable of a parameterized type (like `List<String>`) actually refers to an object of a different parameterized type (like `List<Integer>`).
Lesson 223Generic Varargs and Heap PollutionLesson 888Heap Pollution from Raw Types
Heavy use
of utility methods (`Math`, custom utilities)
Lesson 377Importing Static Methods and Fields
Helper classes
support a public-facing class but shouldn't be used directly by clients
Lesson 724Package-Private for Implementation Cohesion
Helper logic
that needs to manipulate the outer class's internals
Lesson 630Inner Classes and Encapsulation
Here's the problem
These two approaches are functionally identical.
Lesson 1776The Anti-Pattern: if (opt.isPresent()) opt.get()
Hexadecimal
(`0x`): very common for colors, memory addresses, and compact bit representation
Lesson 35Binary, Octal, and Hexadecimal Integer LiteralsLesson 56Integer Literals: Decimal, Hexadecimal, Octal, and Binary
Hibernate's ORM Mapping
Hibernate uses reflection to map your Java objects to database tables.
Lesson 2388Common Use Cases: Frameworks and Libraries
hidden
the compiler uses the *reference type at compile time* to decide which version to call (static binding)
Lesson 466Hiding vs Overriding: Static Method BehaviorLesson 2069Files.isSymbolicLink() and Files.isHidden()
Hidden assumptions
Methods returning null don't clearly signal "I might give you nothing"
Lesson 1755Traditional null Checking: Verbose and Error-Prone
Hidden conflicts
If both JARs contain `com.
Lesson 2522Split Packages: The Problem JPMS Solves
Hidden errors
Exceptions thrown in `finalize` are silently ignored
Lesson 300The finalize Method (Deprecated)
Hidden fields
When both classes have a field with the same name (though this is rare and often discouraged)
Lesson 403The super Keyword: Accessing Superclass Members
Hidden members
Private members that exist in the parent portion of the object but remain completely inaccessible to subclass code
Lesson 716Private Members Are Not Inherited
Hide complexity
Show only what users need to know
Lesson 723Prefer private Fields with Controlled Public Methods
Hide implementation details
you might want to change later
Lesson 722Default to Most Restrictive: The Principle of Least Privilege
High load factor
Overloaded buckets mean longer chains to search
Lesson 1112Performance Characteristics: O(1) Average Case
High load factor (0.9)
Nearly full parking lot.
Lesson 1124The Default Load Factor of 0.75
High read-to-write ratio
If 90% of operations are reads, you're unnecessarily blocking readers from each other
Lesson 1251Performance Implications of Synchronized Wrappers
High-performance concurrent access
(use `ConcurrentHashMap` instead)
Lesson 1254When to Use Synchronized Wrappers
Historically proven
This size has been tested over decades of Java applications and works well for typical file sizes and disk block sizes on most operating systems.
Lesson 1935Default Buffer Size: 8KB Explained
Holidays
Independence Day is July 4th, regardless of time zones
Lesson 1836LocalDate: Representing Dates Without Time
How they work
Every method acquires a lock on the entire collection before executing.
Lesson 986Synchronized Collections vs Concurrent Collections
How to run it
The execution policy hidden behind the implementation
Lesson 2710The Executor Interface: Decoupling Task Submission from Execution
However
If you must search by index or value first, that's still O(n)
Lesson 1041Time Complexity: Removal Operations
Human readability
JSON and XML are easy to inspect and debug
Lesson 2165Alternatives to Java Serialization
Human-readable
Represents dates as they appear on calendars: year-month-day (2024-03-15).
Lesson 1836LocalDate: Representing Dates Without Time
Human-readable data
Serialized bytes are gibberish to humans.
Lesson 2111When to Use and Avoid Serialization

I

IDE hints
that help developers but don't affect runtime behavior
Lesson 2434RetentionPolicy.SOURCE Explained
Ideal for read-heavy workloads
Perfect when you iterate frequently but modify rarely
Lesson 1306CopyOnWriteArrayList: A Fail-Safe Example
Idempotency
Your `close()` method should be *idempotent*, meaning calling it multiple times produces the same result as calling it once.
Lesson 823The close() Method Contract
If `-cp` is specified
Java uses that path *exclusively* and ignores CLASSPATH
Lesson 691The CLASSPATH Environment Variable
If neither exists
Java only searches the current directory
Lesson 691The CLASSPATH Environment Variable
If no
`CloneNotSupportedException` is thrown
Lesson 810CloneNotSupportedException: Cloning Restrictions
If no match
, the JVM **unwinds the stack** one level (returns to the caller)
Lesson 751The Search for a Handler
If no match exists
A new node is added to the end of the chain
Lesson 1108put() Operation: Insertion Process
Ignore the opening line
The `"""` opener doesn't count
Lesson 2237Indentation Removal Algorithm
Ignoring exceptions during close()
When you call `close()` manually in `finally`, you must wrap it in its own `try-catch` because `close()` can throw exceptions.
Lesson 849Manual close() Calls Are Error-Prone
IllegalAccessException
happens when you try to access something you don't have permission to reach—like attempting to call a private method from outside its class without proper access rights.
Lesson 811ReflectiveOperationException Hierarchy
IllegalArgumentException
You passed an invalid argument to a method.
Lesson 790When to Use Unchecked Exceptions: Programming Errors
IllegalStateException
You called a method when the object wasn't ready for it.
Lesson 790When to Use Unchecked Exceptions: Programming Errors
Immediate effect
The deletion happens synchronously—when the method returns, the file is gone
Lesson 2060Files.delete: Deleting Files and Directories
Immediate execution
with no optimization opportunities
Lesson 1410Contrasting Eager Collection Operations
Immediate shutdown
(`shutdownNow()`) is like a fire alarm—you kick everyone out immediately.
Lesson 2768Understanding Graceful vs Immediate Shutdown
Immutability
means the object's state truly cannot change after creation—no methods exist to modify it, and all its fields are unchangeable.
Lesson 75final vs ImmutabilityLesson 1835Instant Immutability and Thread SafetyLesson 1899Replacing Calendar Arithmetic with Period and DurationLesson 2167What Immutability Means for Strings
Immutability guarantee
`String` is immutable.
Lesson 429final Classes in the JDK: String and Wrappers
Immutable collections
Collections from factory methods like `List.
Lesson 1281Why remove() Is Optional and May Throw UnsupportedOperationException
Implement
the service interface with a concrete class
Lesson 2503Implementing a Service Provider Module
Implement `readResolve` for singletons
Protect singleton patterns from being broken by deserialization.
Lesson 2166Best Practices for Safe Serialization
Implement custom `readObject`/`writeObject`
to manually handle old formats
Lesson 2164Versioning Problems and Class Evolution
Implementation classes
need to share data or methods to accomplish a task together
Lesson 724Package-Private for Implementation Cohesion
Implementation-specific
Different `Queue` implementations (like `PriorityQueue`) may have different orderings, but each respects its own `poll()` order
Lesson 1173Queue Iteration Order and Iterator Behavior
Implicit exports
All packages in the JAR are automatically exported
Lesson 2536How JARs Become Automatic Modules
Implicit requires
The automatic module gains `requires transitive` to all other modules it can see
Lesson 2536How JARs Become Automatic Modules
Implicitly casts the result
back to the original type
Lesson 101Increment/Decrement with Different Integer Types
Important constraint
A `public` class must be in a file with the same name (`BankAccount.
Lesson 331Access Modifiers on ClassesLesson 2612join with Milliseconds and Nanoseconds
Important detail
Notice the `L` at the end of `384400000L`?
Lesson 28The long Type: Extended Range Integers
Important quirk
NaN is *not equal to anything*, including itself!
Lesson 44Special Values: Infinity, -Infinity, and NaN
Important rule
`this()` must be the *first* statement in the constructor.
Lesson 321Calling Another Constructor with this()
Improves efficiency
No instance overhead or memory allocation
Lesson 367Common Use Cases for static Methods: Utility Functions
Improves readability
Readers see the variable's purpose immediately, close to where it's used
Lesson 193Best Practices for Variable ScopeLesson 1337Introduction to Comparator Factory Methods
Improves throughput
No startup delay per task
Lesson 2712Thread Pools: Reusing Threads for Efficiency
In a constructor
For instance variables only (we'll cover constructors later in the course)
Lesson 71final and Initialization Requirements
In Java I/O
You typically *read* and *write* UTF-8, but process text internally as UTF-16 (Java strings).
Lesson 2001UTF-16 and UTF-32
In ordered streams
, the behavior is predictable:
Lesson 1468Order Preservation with limit and skip
In the getter
Return a *copy* of the internal object.
Lesson 344Defensive Copying in Getters and Setters
In-place operation
The original list is modified directly; no extra memory for a copy
Lesson 1230Reverse Internals: How Swapping Works
Inaccessible
at runtime, even via reflection (by default)
Lesson 2468Module Descriptors and Accessibility Rules
Including metadata
(like which class contains your `main` method)
Lesson 684What Is a JAR File?
Incompatible types
You pass a `String` where an `Integer` is expected
Lesson 2349Type Safety and IllegalArgumentException Risks
Inconsistency
Different developers check differently (early returns vs nested ifs)
Lesson 1755Traditional null Checking: Verbose and Error-Prone
Inconsistent state
Internal pointers or indices become invalid
Lesson 1247Why Collections Need Synchronization
Incorrect paths
Typos in package names or file paths.
Lesson 693Common Classpath Issues and ClassNotFoundException
Increments modCount
`add()`, `remove()`, `clear()`, `addAll()`, `removeAll()`, etc.
Lesson 1301The modCount Field in ArrayList
Independence
The class has value and meaning on its own, used by multiple unrelated classes
Lesson 619Static Nested Classes vs Top-Level Classes
Independent Execution
Despite sharing memory, each thread has its own execution path, program counter, and call stack.
Lesson 2554Thread: A Lightweight Execution Unit
Independent operations
that don't all need the same lock
Lesson 2660When to Use Synchronized Methods
Index access
Know exactly where you are in the list at any moment.
Lesson 1282The ListIterator Interface Overview
Index-Based Operations
Beyond retrieval, you can insert at specific positions, replace elements, or find the index of an item:
Lesson 969List Interface: Ordered Collections with Duplicates
Indexed Operations
You can use familiar operations like `get(index)`, `set(index, element)`, and `add(index, element)` to work with positions directly.
Lesson 989ArrayList: Dynamic Array Fundamentals
IndexOutOfBoundsException
You accessed an array or list with an invalid index.
Lesson 790When to Use Unchecked Exceptions: Programming Errors
Indirection
May require following pointers or traversing structures
Lesson 1392Collection.stream() vs Arrays.stream() Performance Considerations
Infinite loops
Corrupted internal structures (especially in linked data)
Lesson 1247Why Collections Need Synchronization
Infinite stream support
You can work with infinite streams because you're not trying to store all elements—just process them as they flow
Lesson 1409No Intermediate Storage
Infinite streams become usable
You can take the first 10 elements from an endless generator.
Lesson 1414Intermediate Short-Circuiting: limit Operation
Infinity
Represents a positive value too large to express (like `1.
Lesson 44Special Values: Infinity, -Infinity, and NaN
Inheritance
| Inherited by classes | NOT inherited |
Lesson 518Static Methods vs Default Methods: Key Differences
Inheritance access
Any subclass, *even in a different package*, can access `protected` members
Lesson 330protected: Inheritance and Package Access
Inherited members
Fields and methods the subclass can directly access and use (public, protected, package-private if in same package)
Lesson 716Private Members Are Not Inherited
Inherits from Vector
`Stack` extends the old `Vector` class, which means it carries unnecessary synchronized overhead on every operation—even in single-threaded programs where synchronization isn't needed.
Lesson 1211Why Deque Is Preferred Over Stack Class
initial capacity
and **load factor**—and immediately forward them to the `HashMap` constructor.
Lesson 1054Initial Capacity and Load Factor in HashSetLesson 1125When Rehashing Occurs: The Threshold Calculation
Initialize before the loop
Always set your control variable's starting value
Lesson 158Loop Control Variables and Counting Patterns
Initialize two pointers
one at index `0` (start), one at `list.
Lesson 1230Reverse Internals: How Swapping Works
Initializes the memory
– sets default values (like `0` for numbers, `null` for references)
Lesson 295Object Allocation with new
Inject mocks
Replace private dependencies with test doubles
Lesson 2390Testing: Accessing Private Members
Inlining
The JIT may inline the method body directly at the call site, removing the call overhead entirely
Lesson 468Performance Implications of Dynamic DispatchLesson 2402JIT Compilation Limits with Reflection
inner class
is a non-static nested class declared inside another class.
Lesson 622What Are Inner Classes?Lesson 623Declaring an Inner Class
Input
A `Runnable` — an interface with a single method `void run()` that takes no parameters.
Lesson 2809thenRun Signature and Runnable Interface
Input Parameter
`exceptionally` takes a `Function<Throwable, T>` where `T` matches your future's result type.
Lesson 2836Basic exceptionally Syntax and Return Type
InputStream
is the abstract superclass for all classes that read bytes.
Lesson 1904The InputStream and OutputStream Abstract Classes
Inserting alice1
`HashMap` calls `alice1.
Lesson 557Demonstrating the Bug: A Step-by-Step Example
Insertion order is important
(reproducible iteration)
Lesson 1083Choosing Between HashSet and LinkedHashSet
inside
`BankAccount` (like `getBalance()` or `withdraw()`) can read or modify it.
Lesson 327private: Class-Level EncapsulationLesson 1355Order of Operations: reversed() vs Null Methods
Inspecting
the head element without removing it
Lesson 1167Queue Interface Overview and FIFO Semantics
Install
Drag the JDK icon to the Applications folder or run the `.
Lesson 4Installing the JDK on Your Operating System
Instance synchronized methods
lock on `this` (the specific object)
Lesson 2657synchronized static Methods
Instance variables
Captured via implicit `this` reference
Lesson 1722Capturing Instance Variables and Static Fields
Instance-level (non-static)
Each house built from the blueprint has its own address, its own paint color, its own furniture.
Lesson 358What static Means: Class-Level vs Instance-Level
Instantiation
means you're actually creating the array object in memory using the `new` keyword:
Lesson 243Array Declaration vs InstantiationLesson 313Creating Objects: Using new with Constructors
InstantiationException
is thrown when you try to create an instance of a class that can't be instantiated.
Lesson 811ReflectiveOperationException Hierarchy
Integration
Reuse existing managed executors from frameworks
Lesson 2864Passing Custom Executors to Async Methods
Integrity
Ensures objects maintain valid states throughout their lifetime
Lesson 345Read-Only Properties: Getters Without Setters
Intent is clear
Signals you want to process *all* elements sequentially
Lesson 173Iterating Arrays with Enhanced for Loops
Intent over implementation
Focus on *what* you're doing, not *how*
Lesson 1429map with Method References
Intentional patterns
Silence "deprecation" when you must use a deprecated API temporarily
Lesson 2414Built-In Annotations: When and Why to Use Each
Interactive applications
If you're writing a network protocol or chat application, you flush to send data promptly rather than waiting for the buffer to fill.
Lesson 1957flush() and When to Use It
Interactive output
When writing prompts that users need to see before responding
Lesson 1985flush: Forcing Buffer Contents to Disk
Interface implementation
Documents that you're fulfilling a contract
Lesson 2414Built-In Annotations: When and Why to Use Each
Interfaces (before default methods)
couldn't do this.
Lesson 528Evolution and Backward Compatibility Concerns
Interfaces after
Follow with interfaces, separated by `&`
Lesson 921Syntax: Combining extends with &
Intermediate gadgets
Classes that transform or forward calls
Lesson 2159Gadget Chains and Object Injection
Internal HashMap.Entry overhead
(hash code cache, next pointer for collision chains)
Lesson 1055Memory Overhead: HashMap Values in HashSet
Internal interfaces or contracts
coordinate behavior within a package but aren't part of the public API
Lesson 724Package-Private for Implementation Cohesion
InternalError
Something went critically wrong inside the JVM itself.
Lesson 782VirtualMachineError and LinkageError: System-Level Errors
Interoperability
Algorithms work across different collection implementations.
Lesson 967The Collections Framework: Purpose and Design
Interpreted bytecode
= reading the recipe and cooking step-by-step each time (slower, flexible)
Lesson 25JIT Compilation: From Bytecode to Native Code at Runtime
Interrupt handling
ensures cleanup even if your waiting thread is interrupted
Lesson 2775Common Shutdown Patterns and Best Practices
Intersection
uses the special `&&` operator to match only characters that appear in *both* sets.
Lesson 2299Union and Intersection in Character Classes
Invisible
to other modules at compile time
Lesson 2468Module Descriptors and Accessibility Rules
IOException
for other read failures → abort, alert the user
Lesson 756The Need for Multiple catch Blocks
IPv4
uses four decimal numbers (0-255) separated by dots, like `192.
Lesson 2287IP Address Patterns (IPv4 and IPv6)
IPv6
uses eight groups of four hexadecimal digits separated by colons, like `2001:0db8:85a3:0000:0000:8a2e:0370:7334`, with optional zero-compression (`::`).
Lesson 2287IP Address Patterns (IPv4 and IPv6)
Isolation
Separate critical async tasks from general workload
Lesson 2790Providing a Custom Executor to supplyAsync
Isolation requirements
Separate pools for different subsystems prevent one component from blocking another
Lesson 2781Async Execution Models: Common vs Custom Executors
It doesn't compose
You can't chain further operations cleanly
Lesson 1819Anti-Pattern: isPresent() Before get()
It's procedural, not declarative
You're telling the code *how* to check, not *what* to do with presence or absence
Lesson 1819Anti-Pattern: isPresent() Before get()
It's verbose
More code to write and read than either null checks or functional alternatives
Lesson 1819Anti-Pattern: isPresent() Before get()
Iterate through every bucket
in the old array
Lesson 1126The Rehashing Process: Doubling Capacity
Iteration bottlenecks
Since you must manually synchronize iteration blocks, the collection stays locked for extended periods
Lesson 1251Performance Implications of Synchronized Wrappers
Iteration support
– Ability to traverse all elements (via `Iterator<E> iterator()`)
Lesson 968The Collection Interface: Core Contract

J

JAR file
(Java ARchive) is a single compressed file that bundles multiple compiled `.
Lesson 684What Is a JAR File?
JAR hell
Conflicting library versions on the classpath caused runtime failures that were difficult to diagnose.
Lesson 2461Introduction to JPMS and the Module SystemLesson 2516Classpath Mechanics: How the JVM Finds Classes
Java 11
, the `isEmpty()` method was introduced as its logical inverse—it returns `true` when the `Optional` is **empty**, and `false` when it contains a value.
Lesson 1772The isEmpty() Method (Java 11+)
Java 17
(and enhanced in later versions), switch expressions and enhanced switch statements allow you to explicitly handle `null` cases.
Lesson 155Null Handling and Switch Behavior
Java 6 changed this
, recognizing that implementing an interface method is conceptually similar to overriding: you're providing a concrete implementation for an abstract contract.
Lesson 2407@Override with Interfaces (Java 6+)
Java 7
, Oracle moved the intern pool to the **main heap**.
Lesson 2182Intern Pool Location: PermGen vs Metaspace
Java 7 and earlier
, the String intern pool was stored in **PermGen** (Permanent Generation), a fixed-size memory area separate from the main heap.
Lesson 2182Intern Pool Location: PermGen vs Metaspace
Java 8
, PermGen was completely eliminated and replaced with **Metaspace** (which stores class metadata only, not interned strings).
Lesson 2182Intern Pool Location: PermGen vs Metaspace
Java 9
, if your resource variable is **effectively final** (never reassigned after initialization), you can reference it directly in the try-with-resources statement:
Lesson 1949Effectively Final Resources (Java 9+)
Java is different
In Java, `boolean` is its own separate type with only two possible values: `true` and `false`.
Lesson 55Common Mistakes: boolean vs Numeric Types
Java Runtime Environment
part of your JDK.
Lesson 7Verifying Your Installation with java -version
Java's internal character encoding
.
Lesson 2001UTF-16 and UTF-32
JDK
stands for **Java Development Kit**.
Lesson 1What is the JDK and Why Do You Need It?
JDK tool
introduced with JPMS that creates **custom runtime images**.
Lesson 2544What is jlink and Why Custom Runtime Images Matter
JIT (Just-In-Time) Compilation
is the JVM's clever performance optimization.
Lesson 25JIT Compilation: From Bytecode to Native Code at Runtime
JIT (Just-In-Time) compiler
you learned about earlier.
Lesson 103Performance and Compiler Optimizations
JIT compiler limitations
The JVM cannot inline reflective calls as aggressively
Lesson 2395Performance Overhead of Reflection
JIT-compiled native code
= memorizing your most-ordered dish and cooking it automatically (faster, optimized)
Lesson 25JIT Compilation: From Bytecode to Native Code at Runtime
JIT-friendly
The JVM can inline and optimize MethodHandle invocations far better than reflection.
Lesson 2403MethodHandles as a Faster Alternative
JRE (Java Runtime Environment)
The Middle Layer
Lesson 2JDK vs JRE vs JVM: The Three-Layer Architecture
JSON
(with libraries like Jackson or Gson) converts objects to readable text.
Lesson 2165Alternatives to Java Serialization
Just need a timestamp
Use `Instant` for logging, database timestamps, or measuring duration between events.
Lesson 1856Best Practices: When to Use ZonedDateTime
JVM (Java Virtual Machine)
The Bottom Layer
Lesson 2JDK vs JRE vs JVM: The Three-Layer Architecture
JVM checks current method
for a `try-catch` that surrounds the throw point
Lesson 751The Search for a Handler
JVM optimization level
(JIT compilation improves both, but direct calls benefit more)
Lesson 2398Method Invocation Overhead: invoke vs Direct Calls
JVM overhead
The runtime itself adds small delays
Lesson 2596Sleep Precision and Guarantees

K

K largest elements
Use a *min-heap* (natural ordering or min-comparator) of size K.
Lesson 1191Using PriorityQueue for Top-K Problems
K smallest elements
Use a *max-heap* (reverse comparator) of size K.
Lesson 1191Using PriorityQueue for Top-K Problems
Keep `final`
Accept shallow copying with shared references (often unacceptable)
Lesson 569Final Fields and clone: The Conflict
Keep capture minimal
The fewer variables your lambda captures, the easier it is to understand and test.
Lesson 1726Best Practices for Variable Capture
Keep it the same
when changes are **compatible**:
Lesson 2130Best Practices for serialVersionUID Management
Key `false`
Maps to a `List<T>` containing all elements where the predicate returned `false`
Lesson 1580The Map<Boolean, List<T>> Result Structure
Key `true`
Maps to a `List<T>` containing all elements where the predicate returned `true`
Lesson 1580The Map<Boolean, List<T>> Result Structure
Key-value collections
`ArrayList<HashMap<String, Integer>>`
Lesson 909Collections of Collections: Nested Generics
know
you'll be adding approximately 1,000 elements, specifying that capacity upfront eliminates these expensive resize operations:
Lesson 1003Specifying Initial Capacity ExplicitlyLesson 2294Possessive Quantifiers and Backtracking
Kotlin
chose a different path called **reified generics**, where type parameters remain available at runtime.
Lesson 966Reified Generics in Other Languages: What Java Lacks

L

Lack of Control
You have no built-in way to limit thread count, queue pending tasks, or gracefully handle backpressure.
Lesson 2709The Problem with Manual Thread Management
Lack of JIT Optimizations
The JIT compiler is brilliant at optimizing normal code—it can inline methods, eliminate dead code, and predict branches.
Lesson 2397Why Reflection Is Slower Than Direct Access
Lambda's parameter type `x`
= `Integer` (from target type `Function<Integer, String>`)
Lesson 1733Target Typing with Generic Methods
large arrays
or data structures where memory truly matters—like processing image data or network packets where millions of values add up.
Lesson 32Why int is the Default: Performance and CompatibilityLesson 36Choosing the Right Integer Type for Your Data
Large buffers (128KB–1MB+)
Fewer disk operations, potentially higher throughput for large files, but more memory per stream.
Lesson 1952Buffer Size Selection and Throughput
Large directories
When you need to process directories with many entries
Lesson 2074DirectoryStream Interface Overview
Large enough
to reduce system calls significantly.
Lesson 1935Default Buffer Size: 8KB Explained
Large offsets
`skip(1000000)` touches a million elements
Lesson 1469Performance Implications of skip
Last digit extraction
`number % 10` gives the rightmost digit
Lesson 88The Modulus Operator: Finding Remainders
Lazily evaluated
The stream doesn't process anything until you invoke a terminal operation
Lesson 1384stream() Method on Collections
Lazy evaluation
Operations can be optimized because the stream doesn't need to materialize all results immediately.
Lesson 1367Streams Are Not Data StructuresLesson 1669Lazy Evaluation with Suppliers
Leaderboard Systems
Managing game scores where you need to find the next higher/lower score, or retrieve and remove the top score (`pollFirst()`).
Lesson 1101TreeSet as NavigableSet: Practical Applications
Left rotation (negative distance)
Elements near the front move to the end.
Lesson 1234Collections.rotate: Shifting Elements Circularly
Left side of arrow
Parameter list—what the lambda receives
Lesson 1699Lambda Expression Structure: Arrow Notation
Legacy code compatibility
When working with existing code that expects a `LinkedList` specifically, or when you need to pass the queue to methods accepting `List` parameters.
Lesson 1180When to Use LinkedList as a Queue
Legacy code integration
Suppress "unchecked" or "rawtypes" warnings when interfacing with old APIs
Lesson 2414Built-In Annotations: When and Why to Use Each
Legacy code migration
where many packages need reflection access during the transition to JPMS
Lesson 2494Open Modules: Making All Packages Reflectively Accessible
Legacy codebases
with complex dependency graphs that would require extensive refactoring
Lesson 2524Migration Strategy: When to Use Module Path vs Classpath
Legacy libraries
When third-party code requires `File` but you're using `Path`
Lesson 2032Converting Between Path and File
Legacy system compatibility
– Interfacing with old systems requiring `float`
Lesson 46When to Use double Over float
Length constraints
3-16 characters
Lesson 2289Username and Identifier Patterns
Lenient
Legacy data migration with questionable dates
Lesson 1893Case Sensitivity and Strict vs Lenient Parsing
Less Boilerplate
Omitting parameter types lets you focus on the logic rather than repetitive type declarations.
Lesson 1717Type Inference Benefits and ReadabilityLesson 2719The Executors Factory Class Overview
Less code
No manual `close()`, no null checks
Lesson 838Try-With-Resources vs Traditional Try-Finally
Less noise
No need to declare parameter names
Lesson 1429map with Method References
Let callers decide
More restrictive bounds = fewer types can satisfy them = smaller audience for your code
Lesson 927Common Pitfalls: Overly Restrictive Bounds
Level-by-level traversal
Processing data in waves or generations (breadth-first algorithms)
Lesson 1218Stack vs Queue Trade-offs in Problem Solving
Libraries and Tools
Pre-written code that helps you accomplish common tasks (like working with text, numbers, or files) without starting from zero.
Lesson 1What is the JDK and Why Do You Need It?
Library maintenance
Warn users before removing functionality in future versions
Lesson 2414Built-In Annotations: When and Why to Use Each
LIFO stack
(use only operations at one end, like push/pop)
Lesson 1193What Is a Deque? Double-Ended Queue Explained
Lightweight
Creating a thread is much faster and uses fewer resources than creating a new process.
Lesson 2554Thread: A Lightweight Execution Unit
Limit depth
Use the `maxDepth` parameter to avoid traversing deeper than necessary
Lesson 2093Performance and Resource Management in Walks
Limitation
`join` requires direct thread references.
Lesson 2617join vs Other Synchronization: When to Use Each
Limited scope
Apply to the smallest code block necessary (method > class)
Lesson 2414Built-In Annotations: When and Why to Use Each
LinkedHashMap
When you want to preserve the order keys were first encountered
Lesson 1577Custom Map Types with groupingBy Supplier
LinkedHashMap/LinkedHashSet
Any structural modification
Lesson 1304Fail-Fast in HashMap and Other Collections
LinkedHashSet
, elements appear in exactly the order you inserted them—no exceptions.
Lesson 1080Iterating LinkedHashSetLesson 1083Choosing Between HashSet and LinkedHashSet
LinkedList suffers here
Each node is a separate object allocated somewhere in the heap—potentially far from the previous and next nodes.
Lesson 1043Cache Locality and Performance Impact
LinkedList's Iterator
`LinkedList` must follow node references (pointers) to traverse from one element to the next.
Lesson 1044Iteration Performance: Sequential Access Patterns
Linux
Often uses a different priority scheme entirely, and thread priorities may have minimal effect depending on the scheduler policy.
Lesson 2629Platform-Dependent Priority Mapping
List methods
on the same `LinkedList`:
Lesson 1177Queue vs List Methods on LinkedList
Local context
Variable values, IDs, states relevant to the current method
Lesson 773Logging and Rethrowing: Best Practices
Local variables
(declared inside methods) do *not* — you must assign them a value before use, or the compiler will reject your code.
Lesson 67Default Values for Fields vs Local VariablesLesson 74Naming Conventions for final Variables
Local variables and parameters
(closest scope)
Lesson 629Shadowing and Name Resolution in Inner Classes
Local variables get nothing
If you declare an `int` inside a method and try to use it without assigning a value, the compiler throws an error: *"variable might not have been initialized.
Lesson 67Default Values for Fields vs Local Variables
LocalDate, LocalDateTime
Chronological order
Lesson 1133Creating TreeMaps with Natural Ordering
LocalDateTime
offer similar methods for hours, minutes, seconds, and nanoseconds.
Lesson 1844with Methods: Replacing Specific Fields
LocalTime
and **LocalDateTime** offer similar methods for hours, minutes, seconds, and nanoseconds.
Lesson 1844with Methods: Replacing Specific Fields
Location marker
The `^` symbol points to where the compiler got confused
Lesson 14Understanding Compilation Errors
Lock acquisition overhead
Every operation pays the cost of claiming and releasing a lock, even simple reads
Lesson 1251Performance Implications of Synchronized Wrappers
Lock acquisition/release
adds overhead to every single method call
Lesson 1032Vector's Synchronization Mechanism
Lock ordering complexity
Enforcing a consistent lock acquisition order across many resources and code paths becomes much harder to verify.
Lesson 2694Deadlock with Multiple Threads and Resources
Lock scope
is how much code executes while holding a lock.
Lesson 2699Avoiding Nested Locks and Minimizing Lock Scope
Lock-free operations
for scalability
Lesson 1254When to Use Synchronized Wrappers
Locks and synchronization
Release locks so other threads can proceed.
Lesson 734Common finally Use Cases: Resource Cleanup
Log suppressed exceptions explicitly
Don't rely on default exception output.
Lesson 847Best Practices for Suppressed Exceptions
Logical AND
`&&` — both conditions must be true
Lesson 112Chaining Comparisons and Operator Precedence
Logical cohesion
When a class is meaningless outside its parent context, nesting signals this relationship immediately to readers.
Lesson 621Common Use Cases and Best Practices
Logical Equality (`equals()`)
Checks if two objects are *meaningfully equivalent*—like asking "Do these two boxes contain the same thing?
Lesson 541The equals Method: Reference vs Logical Equality
Logical grouping
When a class is conceptually part of another class but doesn't need access to its instance data, nest it statically.
Lesson 618Organizing Related Classes with Static Nested Classes
Logical operators
(`&&`, `||`) work exclusively with **boolean expressions**
Lesson 122Bitwise vs Logical Operators: & vs &&, | vs ||
Logical OR
`||` — at least one condition must be true
Lesson 112Chaining Comparisons and Operator Precedence
Logical organization
Model real-world relationships
Lesson 393What Is Inheritance? The extends Keyword
Logical XOR
`^` — exactly one condition must be true
Lesson 112Chaining Comparisons and Operator Precedence
Long critical sections
If some threads hold locks for extended periods, others may wait forever
Lesson 2705What Is Starvation?
Long iterations
Manual synchronization blocks all other access during traversal
Lesson 1251Performance Implications of Synchronized Wrappers
Long-running operations
(I/O, network calls, heavy computation)
Lesson 2660When to Use Synchronized Methods
Long-running streams
Periodically flush to prevent data loss if the program crashes
Lesson 1931Flushing Output StreamsLesson 1938close vs flush: Automatic Flushing on Close
Long-term persistence
Serialization breaks when you change class definitions.
Lesson 2111When to Use and Avoid Serialization
Look for patterns
missing semicolons and typos are most common at first
Lesson 14Understanding Compilation Errors
Looking up with alice2
`HashMap` calls `alice2.
Lesson 557Demonstrating the Bug: A Step-by-Step Example
Lookup reliability
`contains()` finds equal objects even if they're different instances
Lesson 1093Testing Your equals and hashCode Implementations
Loop body
– Runs if the condition was `true`
Lesson 166Executing for Loops: Step-by-Step Evaluation Order
Lost updates
One thread's changes overwrite another's
Lesson 1247Why Collections Need Synchronization
Low load factor (0.5)
Lots of empty spaces.
Lesson 1124The Default Load Factor of 0.75

M

Magnitude
Values outside the smaller type's range wrap around unpredictably.
Lesson 78Narrowing Conversions: Potential Data Loss
Main class
(if one was specified when creating the JAR)
Lesson 2510Inspecting Modular JAR Contents with jar --describe-module
Main-Class
Specifies which class contains the `main` method to run when you execute the JAR:
Lesson 686The JAR Manifest File
Maintain backward compatibility
by keeping old fields (perhaps as `transient` or deprecated)
Lesson 2164Versioning Problems and Class Evolution
Maintain proper interrupt semantics
across your application
Lesson 2598Restoring Interrupt Status in catch Blocks
Maintaining Processing Order
Imagine you're collecting user actions in a web application.
Lesson 1081Use Cases for Insertion Order
Maintaining user input order
Processing configuration or form data in sequence
Lesson 1151When to Use LinkedHashMap vs HashMap
Maintains
a fixed number of threads (the pool size)
Lesson 2712Thread Pools: Reusing Threads for Efficiency
Maintenance
Code reviews and build systems can track deprecation warnings as technical debt
Lesson 2409@Deprecated: Compiler Warnings
Maintenance errors
when superclass signatures change
Lesson 423Best Practices: Always Use @Override
Maintenance nightmare
Developers can't tell which JAR owns which classes in a package.
Lesson 2522Split Packages: The Problem JPMS Solves
Maintenance nightmares
Code relying on internal implementation details breaks when classes evolve
Lesson 2360Performance and Security Implications of Field Access
Make `public` deliberately
Only expose what's part of your class's intended interface
Lesson 337The Principle of Least Privilege
Make close() methods robust
When implementing `AutoCloseable`, ensure your `close()` method never throws unless absolutely necessary.
Lesson 847Best Practices for Suppressed Exceptions
Make debugging easier
(fewer places to check when things go wrong)
Lesson 722Default to Most Restrictive: The Principle of Least Privilege
Make variables immediately usable
(no need to remember to initialize later)
Lesson 68Declaration and Initialization in One Statement
Making distribution easy
one file to download, copy, or deploy
Lesson 684What Is a JAR File?
Making fields transient
The field is ignored during serialization going forward
Lesson 2164Versioning Problems and Class Evolution
Malformed input
You're reading bytes that don't form valid characters in the declared encoding (e.
Lesson 2006Encoding Errors and Replacement Characters
Management Complexity
Tracking thread lifecycles becomes nightmarish.
Lesson 2709The Problem with Manual Thread Management
Manual normalization
happens only for the `normalized()` method, which converts excess months to years:
Lesson 1864Period Arithmetic and Normalization
Many competing threads
Contention skyrockets as more threads fight for the single lock
Lesson 1251Performance Implications of Synchronized Wrappers
Map before filter
wastes work:
Lesson 1482Combining map and filter
Map your dependency graph
to identify leaf modules (libraries with no internal dependencies)
Lesson 2526The Bottom-Up Migration Strategy
Marker behavior
You need a type flag with no methods at all
Lesson 532Decision Criteria: A Practical Checklist
marker interface
is an interface with no methods or constants—it exists purely to tag a type with a capability or characteristic.
Lesson 530Marker Interfaces vs Empty Abstract ClassesLesson 561The Cloneable Interface and Object.cloneLesson 2104The Serializable Marker Interface
Massive arrays
– Storing millions of values where memory is tight
Lesson 46When to Use double Over float
MasterCard
(simplified to 51-55 range):
Lesson 2288Credit Card Number Patterns
Match parameter count
from the functional interface method
Lesson 1752Constructor Overloading Resolution
Match parameter types
(exact match or compatible through widening/boxing)
Lesson 1752Constructor Overloading Resolution
Matcher
applies that compiled pattern to a particular input sequence (a `CharSequence`, which includes `String`).
Lesson 2244Introduction to Pattern and Matcher
Medium buffers (8KB–64KB)
Good balance between performance and memory usage.
Lesson 1952Buffer Size Selection and Throughput
Memory
Singleton collections use significantly less memory because they don't pre-allocate array space.
Lesson 1258Singleton vs Single-Element List Performance
memory addresses
stored in the reference variables, not the actual data inside the objects.
Lesson 286Reference Equality with ==: Comparing Memory AddressesLesson 287Why == Fails for String Comparison
Memory buffers
Writes may be buffered before reaching main memory
Lesson 2680The Visibility Problem: Why volatile Exists
Memory consumption
If you call `distinct()` on a stream of 1 million elements, the operation might store up to 1 million unique values in memory.
Lesson 1447The Stateful Nature of distinct
Memory efficiency matters
(no extra pointers to track order)
Lesson 1083Choosing Between HashSet and LinkedHashSet
Memory locality
Elements sit consecutively in memory, making the CPU cache very happy
Lesson 1227Performance Characteristics of Sorting
Memory matters
Timsort requires **O(n)** extra space for merging.
Lesson 1364Sorting Performance Considerations
Memory pressure
Buffers remain allocated even when you're done
Lesson 1942Why Closing Streams Matters: Resource Leaks Explained
Memory tuning
Use heap size parameters, not PermGen settings
Lesson 2182Intern Pool Location: PermGen vs Metaspace
Memory used
for any intermediate results you create manually
Lesson 1410Contrasting Eager Collection Operations
Merge sort
Split the array, sort each half recursively, merge results
Lesson 233When to Use Recursion: Tree Traversal and Divide-and-Conquer
Merger function
– combines both results into a final output
Lesson 1609Basic teeing Example: Min and Max in One Pass
Message
Explain the specific problem in human-readable form
Lesson 816Constructors: Message, Cause, and Both
MessagePack
and **Avro** provide compact binary formats with schema support.
Lesson 2165Alternatives to Java Serialization
Metaspace
(which stores class metadata only, not interned strings).
Lesson 2182Intern Pool Location: PermGen vs Metaspace
Method arguments
What parameter type does the method expect?
Lesson 1727What Is Target Typing?
Method complexity
(simple getters show bigger relative differences)
Lesson 2398Method Invocation Overhead: invoke vs Direct Calls
Method level
Suppresses warnings for the entire method
Lesson 2413@SuppressWarnings: Scope and Best Practices
Method Lookup
Every reflective call requires the JVM to look up which method to invoke by matching method names and parameter types at runtime.
Lesson 2397Why Reflection Is Slower Than Direct Access
Method lookup overhead
– finding the right constructor through metadata
Lesson 2378Performance and Security Considerations
Method name matches
exactly (case-sensitive)
Lesson 2406@Override: Compiler Verification
Method overloading
works the same way in Java.
Lesson 207Method Overloading Fundamentals
Method overriding
lets the subclass provide its own implementation of an inherited method while keeping the same method signature (name, parameters, and return type).
Lesson 414What Is Method Overriding?
Method resolution
Finding the actual method implementation adds indirection
Lesson 2350Performance Costs of Reflective Invocation
Method-level locking isn't enough
Synchronizing individual methods doesn't make compound operations (like "check-then-add") thread-safe.
Lesson 1030What Is Vector: A Legacy Synchronized List
Method-level type parameters
are declared on individual methods and exist only within that specific method's scope.
Lesson 862Type Parameter Scope: Class-Level vs Method-Level
Migration cost outweighs benefits
for stable, working applications nearing end-of-life
Lesson 2524Migration Strategy: When to Use Module Path vs Classpath
Migration guidance
Use `since` and `forRemoval` to communicate timelines
Lesson 2414Built-In Annotations: When and Why to Use Each
Millisecond + Nanosecond precision
Lesson 2591Thread.sleep Syntax and Time Units
Minimal cross-package access
within your application
Lesson 2525Assessing Your Application's Readiness for Modules
Minimize public classes
Every `public` class is a commitment.
Lesson 712Cross-Package Access Patterns and Best Practices
Minimize reallocations
– Grow aggressively to avoid frequent copies
Lesson 1010Memory Implications of Capacity Management
Minimize scope
Convert once at integration points, not scattered throughout code
Lesson 1902Interoperating with Legacy APIs
Minimize wasted space
– Keep capacity close to actual size
Lesson 1010Memory Implications of Capacity Management
Missing `serialVersionUID`
One version of your class had an explicit `serialVersionUID`, but the other doesn't (or uses the default computed value)
Lesson 2125InvalidClassException: Version Mismatch Errors
Missing JAR files
You forgot to include a required JAR in your classpath.
Lesson 693Common Classpath Issues and ClassNotFoundException
Mitigation strategy
Cache your reflection objects after calling `setAccessible` once, rather than obtaining and configuring them repeatedly.
Lesson 2400setAccessible and Security Manager Overhead
Mixed workloads
Reads remain fast even while writes are happening, thanks to non-blocking read operations.
Lesson 1165Performance Characteristics: Read vs Write Operations
Modern API design
Uses interfaces and utility methods following current Java best practices
Lesson 2025Introduction to NIO.2 and the Path Interface
Modern hardware
– Today's processors handle `double` efficiently
Lesson 46When to Use double Over float
Modern replacement
Use `try-with-resources` for `AutoCloseable` resources, or explicit `close()` methods with try- finally blocks.
Lesson 577Deprecation of finalize in Java 9+
Modern shortcut
You can skip Step 1 entirely—`instanceof` handles it!
Lesson 543Implementing equals: The Step-by-Step Recipe
Modifier
| **Same Class** | **Same Package** | **Subclass** | **Everywhere** |
Lesson 335Comparing Access Levels: A Decision Matrix
Modify inside the loop
Update the variable so the condition eventually becomes false
Lesson 158Loop Control Variables and Counting Patterns
Modifying class hierarchy
(adding/removing `Serializable` superclasses)
Lesson 2164Versioning Problems and Class Evolution
Modifying the list structure
(removing elements safely)
Lesson 1296Enhanced For Loop vs Traditional For Loop
modular JAR
is simply a JAR file that contains a compiled `module-info.
Lesson 2508What Are Modular JARs?Lesson 2509Creating a Modular JAR with javac and jar
Modular JAR on classpath
Module descriptor is ignored; treated as non-modular
Lesson 2515Modular JARs vs Non-Modular JARs at Runtime
Modular JARs
– already JPMS-ready, easiest to work with
Lesson 2525Assessing Your Application's Readiness for Modules
Module accessibility validation
(checking module exports/opens)
Lesson 2400setAccessible and Security Manager Overhead
Module name derived
From the JAR filename (or `Automatic-Module-Name` in MANIFEST.
Lesson 2515Modular JARs vs Non-Modular JARs at Runtime
Module name generation
The system derives a module name from the JAR filename (stripping version numbers and normalizing characters)
Lesson 2536How JARs Become Automatic Modules
Modulus (%)
Returns the *remainder* after division.
Lesson 86The Five Basic Arithmetic Operators: +, -, *, /, %
Monitor large trees
Walking millions of files can be slow and memory-intensive
Lesson 2093Performance and Resource Management in Walks
Monitor upstream projects
Many libraries are actively adding module support
Lesson 2543Migration Strategy: From Automatic to Explicit Modules
Monitoring
Track resource usage per task category
Lesson 2790Providing a Custom Executor to supplyAsync
Monolithic JDK
The entire Java runtime library loaded regardless of what you actually needed, making Java too heavyweight for modern applications.
Lesson 2461Introduction to JPMS and the Module System
More memory waste
if you don't fill the vector completely
Lesson 1033Vector Growth Strategy: Doubling Capacity
More precise
(enforcing 0-255 range):
Lesson 2287IP Address Patterns (IPv4 and IPv6)
More responsibility
Must implement `writeExternal`/`readExternal` correctly
Lesson 2157Externalizable vs Serializable: Trade-offs and Decision Guide
Most of the time
, this is a single assignment operation—genuinely O(1).
Lesson 1039Time Complexity: Insertion at End
most specific method
rule you already know, but varargs are considered *less specific* than fixed-parameter methods.
Lesson 220Method Overloading with VarargsLesson 1732Ambiguity and Overload Resolution
Move pointers inward
increment start, decrement end
Lesson 1230Reverse Internals: How Swapping Works
Move the tail reference
to point to the new node
Lesson 1023Adding Elements to the End
Move up one level
to modules that depend only on your newly modularized leaves
Lesson 2526The Bottom-Up Migration Strategy
Multi-catch (reassignment NOT allowed)
Lesson 763The Implicit final in Multi-Catch
Multi-core systems
You need multiple CPU cores to benefit
Lesson 1362Parallel Sorting with parallelSort()
Multi-level transformations
downstream collectors that process grouped data further
Lesson 1522Why collect Is the Gateway to Advanced Collectors
Multi-source queries
Querying multiple databases where each contains part of the answer
Lesson 2767Use Cases: invokeAll vs invokeAny
Multiple capabilities
A class can implement `Serializable` *and* many other interfaces without conflict.
Lesson 530Marker Interfaces vs Empty Abstract Classes
Multiple implementations
`ServiceLoader` can discover zero, one, or many implementations
Lesson 2500The 'uses' Directive in module-info.java
Multiple inheritance required
A class must fulfill multiple contracts (e.
Lesson 532Decision Criteria: A Practical Checklist
Multiple methods needed
The interface has more than one abstract method
Lesson 649When to Prefer Lambdas Over Anonymous Classes
Multiple Providers
If multiple modules provide the same service, you'll get all of them.
Lesson 2504Loading Services with ServiceLoader.load()
Multiple readers
Can always read without blocking (using volatile reads)
Lesson 1160ConcurrentHashMap Overview: Lock Striping Architecture
multiple resources
in a single try-with-resources statement by separating them with semicolons.
Lesson 831Multiple Resources in Try-With-ResourcesLesson 1947Multiple Resources in Try-With- Resources
Multiple Similar Parameters
When parameters have similar roles, explicit types clarify which is which.
Lesson 1717Type Inference Benefits and Readability
Multiple threads
will access the same collection instance
Lesson 1247Why Collections Need Synchronization
Multiple threads, high contention
→ Migrate to `ConcurrentHashMap`
Lesson 1158Migrating from Hashtable to Modern Alternatives
Multiple writers
Can modify different segments simultaneously
Lesson 1160ConcurrentHashMap Overview: Lock Striping Architecture
Must use `abstract` keyword
in the method signature
Lesson 480Abstract Method Syntax and Rules
Mutability
Both `Date` and `Calendar` objects were mutable, meaning their values could be changed after creation.
Lesson 1895Problems with java.util.Date and java.util.CalendarLesson 1899Replacing Calendar Arithmetic with Period and Duration

N

N operations
(the adds) + **log N operations** (the resizes that each copy O(n) elements) = **O(N) total work**
Lesson 1017Counting Operations: N Adds and Log N Resizes
Name Conflicts
When two classes have the same simple name (e.
Lesson 678When to Use FQNs vs Import Statements
named groups
when readability and maintenance matter more than typing a few extra characters.
Lesson 2275Named Groups vs Numbered GroupsLesson 2277Backreferences to Named Groups
Namespace management
Instead of creating `HashMap` and `HashMapEntry` as separate top-level classes, Java uses `HashMap.
Lesson 618Organizing Related Classes with Static Nested ClassesLesson 621Common Use Cases and Best Practices
Namespace organization
You want to group related classes under a single name (e.
Lesson 619Static Nested Classes vs Top-Level Classes
NaN
(Not-a-Number): Represents an undefined or unrepresentable result (like `0.
Lesson 44Special Values: Infinity, -Infinity, and NaN
Nanosecond precision
You can even add nanoseconds as a second argument:
Lesson 1828Creating Instants: now() and ofEpochSecond()
narrowing conversion
occurs when you try to assign a value from a larger data type to a smaller one—like pouring water from a big bucket into a small cup.
Lesson 78Narrowing Conversions: Potential Data LossLesson 81Precision Loss in Floating-Point to Integer Casts
Natural Formatting
Perfect for SQL, JSON, HTML, or any formatted text
Lesson 2234What Are Text Blocks?
NavigableMap
come in—they extend the sorted interfaces with powerful navigation methods that let you "walk around" your collection with precision.
Lesson 975NavigableSet and NavigableMap: Enhanced Navigation
NavigableSet
and **NavigableMap** come in—they extend the sorted interfaces with powerful navigation methods that let you "walk around" your collection with precision.
Lesson 975NavigableSet and NavigableMap: Enhanced Navigation
Need flexibility
the same logic applies to multiple types
Lesson 1698When to Use Primitive Specializations vs Generics
Negative `n`
Removes up to `n` spaces from each line (won't remove non-whitespace)
Lesson 2221The indent Method: Adding Leading Whitespace
Negative distance
→ elements rotate **to the left** (toward the beginning)
Lesson 1235Rotate with Positive and Negative Distances
Negative indices
Unlike some languages, Java doesn't support counting backwards from the end
Lesson 245ArrayIndexOutOfBoundsException and Bounds Checking
Negative int
(any negative number, typically -1): "I come *before* the other object"
Lesson 1312The compareTo Method Signature
Negative limit
Splits as many times as possible and **keeps** trailing empty strings.
Lesson 2208Limit Parameter in split(): Controlling Array Size
Negative Lookahead `(?!...)`
Asserts that what follows does *not* match the pattern
Lesson 2302Understanding Zero-Width Assertions
Negative Lookbehind `(?<!...)`
Asserts that what precedes does *not* match the pattern
Lesson 2302Understanding Zero-Width Assertions
negative value
if not found: specifically `(-(insertion point) - 1)`, where insertion point is where the element would belong
Lesson 1222Collections.binarySearch on Sorted ListsLesson 1313Return Values: Negative, Zero, PositiveLesson 1319The compareTo Method Signature and Return Values
Neither null
delegates to the wrapped comparator
Lesson 1350The nullsFirst() Method: Null-Safe Comparisons
Nested causes
if the exception wrapped another exception
Lesson 768Rethrowing the Same Exception Instance
Nested class
Overkill if only one method needs it
Lesson 639Practical Use Cases for Local Classes
Nested if statements
let you place one `if` statement inside another, creating a decision tree with multiple levels.
Lesson 138Nested if Statements: Multi-Level Decisions
Nested locks
occur when code acquires one lock while already holding another.
Lesson 2699Avoiding Nested Locks and Minimizing Lock Scope
Nested try-catch
The `close()` method itself throws exceptions, requiring *another* try-catch inside `finally`
Lesson 850The Classic finally Block Pattern
Network I/O
Often benefits from larger buffers (64KB+) to match TCP window sizes.
Lesson 1952Buffer Size Selection and Throughput
Network operations
If a connection times out, the caller might retry, use cached data, or notify the user to check their connection.
Lesson 789When to Use Checked Exceptions: Recoverable Conditions
Network sockets
Close connections to free up ports and system resources.
Lesson 734Common finally Use Cases: Resource Cleanup
Neutrality
`identity op x = x` (the identity doesn't change results)
Lesson 1507Identity Element Requirements: Associativity and Neutrality
Never deserialize untrusted data
This is rule zero.
Lesson 2166Best Practices for Safe Serialization
Never make fields public
Always use accessor methods to preserve encapsulation
Lesson 712Cross-Package Access Patterns and Best Practices
Never reuse
the class's type parameter name in a method declaration unless you truly intend to create an independent type parameter (which is rarely what you want)
Lesson 873Common Pitfalls: Type Parameter Shadowing
Never static-import common names
like `of`, `get`, or `create` that exist in many classes
Lesson 675Static Import Anti-Patterns and Best Practices
Never throw exceptions
from `process()` — they halt compilation with cryptic errors.
Lesson 2460Debugging Annotation Processors
Never throws checked exceptions
Unlike most I/O classes, PrintWriter methods don't throw IOException; you check errors with `checkError()`
Lesson 2016PrintWriter Overview: Formatted Text Output
New fields
that store additional state specific to the subclass
Lesson 399Adding New Fields and Methods in Subclasses
New methods
that provide behaviors the superclass doesn't offer
Lesson 399Adding New Fields and Methods in Subclasses
New node's `next`
→ points to the target node (the one originally at this position)
Lesson 1024Inserting Elements in the Middle
New node's `prev`
→ points to the node that was before the target
Lesson 1024Inserting Elements in the Middle
New tasks are rejected
any subsequent `execute()` calls throw `RejectedExecutionException`
Lesson 2715Graceful Shutdown: The shutdown Method
New value
The value to assign to the field
Lesson 2353Field.set: Writing Field Values
No `ConcurrentModificationException`
The iterator cannot detect modifications because it's working with its own copy
Lesson 1306CopyOnWriteArrayList: A Fail-Safe Example
No `transient` keyword needed
Since nothing is automatic, you choose what to serialize
Lesson 2149The Externalizable Interface and Its Contract
No accidental coupling
Classes can't depend on internal helper logic
Lesson 523Visibility Rules: Private Methods Cannot Be Overridden
No automatic field serialization
You must explicitly write and read every field
Lesson 2149The Externalizable Interface and Its Contract
No Capacity Restrictions
`ArrayDeque` has no fixed capacity limit.
Lesson 1202What is ArrayDeque? Overview and Purpose
No chaining
You can't say "when this completes, do that next"
Lesson 2777What is CompletableFuture and Why Use It?
No checked exceptions
You can't throw checked exceptions from `run()`
Lesson 2749The Callable<V> Interface and Its Purpose
No class required
You can bound by interfaces only: `<T extends Interface1 & Interface2>`
Lesson 921Syntax: Combining extends with &
No combination exists
for your specific accumulation logic
Lesson 1623When to Write Custom Collectors vs Compose Existing Ones
No combining
You can't easily merge results from multiple futures
Lesson 2777What is CompletableFuture and Why Use It?
No compiler help
The compiler won't warn you if you forget to check
Lesson 1755Traditional null Checking: Verbose and Error-Prone
No concurrent reads
even though multiple threads could safely read simultaneously
Lesson 1032Vector's Synchronization Mechanism
No ConcurrentModificationException
You can modify the collection while iterating without throwing exceptions
Lesson 1305What Is Fail-Safe Behavior?
No constructors
You cannot write a constructor inside an interface.
Lesson 495Interfaces vs Abstract Classes: Initial Comparison
No date information
(no year, month, or day)
Lesson 1838LocalTime: Representing Time Without Date
No direct dependency
You don't `requires` the provider modules—they can be added or removed without recompiling your consumer module
Lesson 2500The 'uses' Directive in module-info.java
No duplicate logic
The iteration code already exists in `HashMap`
Lesson 1053HashSet Iterator: Iterating HashMap Keys
No Duplicates
If you try to add an element that's already in the set, HashSet simply ignores it.
Lesson 993HashSet: Unique Elements with Hashing
No encapsulation
All public classes in all JARs are globally accessible
Lesson 2516Classpath Mechanics: How the JVM Finds Classes
No exception handling
You can't attach error handlers; exceptions surface only during `get()`
Lesson 2777What is CompletableFuture and Why Use It?
No exception is thrown
this is a *compatible* class change (as you learned in the previous lesson)
Lesson 2127Adding Fields to a Serializable Class
No exception occurs
code flows normally through `try`, skips `catch`, runs `finally`
Lesson 733The finally Block: Guaranteed Execution
No exceptions
The iterator never throws `ConcurrentModificationException`, even if other threads modify the map
Lesson 1307ConcurrentHashMap and Weakly Consistent IteratorsLesson 1992StandardCharsets for Common Encodings
No explicit dependencies
The JVM doesn't know what your application needs until runtime failure occurs
Lesson 2516Classpath Mechanics: How the JVM Finds Classes
No flattening needed
→ Use `map`
Lesson 1439flatMap vs map: When to Use Each
No full-array scanning
You only search within one bucket, not the entire HashMap
Lesson 1112Performance Characteristics: O(1) Average Case
No guarantees
The garbage collector might never call `finalize()`, or it might call it hours after your object becomes unreachable
Lesson 300The finalize Method (Deprecated)Lesson 574The finalize Method: Legacy Cleanup Mechanism
No hash collisions
Each enum ordinal is unique by definition
Lesson 603EnumMap Performance: Array-Based Implementation
No indexing
You can't ask for "the 5th element" of a stream like you can with a `List`.
Lesson 1367Streams Are Not Data Structures
No inheritance baggage
`Deque` doesn't inherit problematic methods
Lesson 1211Why Deque Is Preferred Over Stack Class
No inheritance relationships
You cannot list a parent and child exception together (e.
Lesson 761Multi-Catch Syntax (Java 7+)
No instance fields
Interfaces cannot hold state (instance variables).
Lesson 495Interfaces vs Abstract Classes: Initial Comparison
No interface methods
unless the class itself declares them
Lesson 2334Getting Declared Methods: Class-Specific Methods Only
No intermediate storage
Elements pass through without being collected first
Lesson 1613Performance Benefits of teeing Over Multiple Passes
No JIT optimization
The compiler can't inline or optimize reflective calls as aggressively
Lesson 2350Performance Costs of Reflective Invocation
No Manual Configuration
The module system handles discovery automatically—no classpath scanning or configuration files needed.
Lesson 2504Loading Services with ServiceLoader.load()
No memory allocation
Unlike reading into a byte array, skipping doesn't require buffer space
Lesson 1910The skip(long) Method for Skipping Bytes
No modification
Streams don't have `add()` or `remove()` methods—they transform data without changing the original source.
Lesson 1367Streams Are Not Data Structures
No null checks needed
– you always get a numeric result, never null
Lesson 1594Handling Empty Streams with Summing and Averaging Collectors
No null elements permitted
throws `NullPointerException` immediately
Lesson 1244Immutable Factory Methods: List.of, Set.of, Map.of
No nulls
TreeSet cannot store `null` (it needs to compare elements)
Lesson 1066What is TreeSet? Sorted Set Fundamentals
No overhead
Direct access to array elements without additional wrappers
Lesson 1392Collection.stream() vs Arrays.stream() Performance Considerations
No pointer chasing
Direct array access is fast
Lesson 1227Performance Characteristics of Sorting
No read/write distinction
Reading requires the same exclusive lock as writing
Lesson 1251Performance Implications of Synchronized Wrappers
No recovery
Unlike some systems with "recycle bins," this is permanent deletion
Lesson 2060Files.delete: Deleting Files and Directories
No return value
`forEach` returns `void`—it doesn't produce a result you can store or pass along
Lesson 1488Understanding forEach as a Terminal OperationLesson 2749The Callable<V> Interface and Its Purpose
No risk of `NoSuchElementException`
the guard condition prevents it
Lesson 1278The Canonical Iterator Loop Pattern
No runtime type information
At runtime, `Box<String>` and `Box<Integer>` are both just `Box` containing `Object` references
Lesson 893Type Parameters Become Object
No shared state needed
You're defining a pure contract of capabilities
Lesson 532Decision Criteria: A Practical Checklist
No size limit
Works with gigabytes of data as easily as kilobytes
Lesson 2014Processing Large Files with readLine
No state needed
These markers don't require constructors, fields, or shared logic.
Lesson 530Marker Interfaces vs Empty Abstract Classes
No surprises
Forgetting about a global CLASSPATH can cause mysterious bugs
Lesson 691The CLASSPATH Environment Variable
No time zone context
`LocalDate` doesn't know about time zones.
Lesson 1836LocalDate: Representing Dates Without Time
No unnecessary synchronization
Operations are fast in single-threaded contexts
Lesson 1211Why Deque Is Preferred Over Stack Class
No wasted transformations
If only 10 elements are needed from a million-element stream, only those 10 get processed
Lesson 1406Why Laziness Matters for Performance
NoClassDefFoundError
happens when a class *was* available during compilation but is missing at runtime.
Lesson 693Common Classpath Issues and ClassNotFoundExceptionLesson 782VirtualMachineError and LinkageError: System-Level Errors
Non-boolean field
Use `get` + capitalized name
Lesson 341Boolean Property Getters: is vs get
Non-capturing groups
use the syntax `(?
Lesson 2269Non-Capturing Groups: (?:...)
non-deterministic
they appear randomly, are hard to reproduce, and can pass testing only to fail in production under heavy load.
Lesson 1247Why Collections Need SynchronizationLesson 2577Starting Multiple ThreadsLesson 2642What Is a Race Condition?
Non-Latin alphabets
Cyrillic (Русский), Greek (Ελληνικά), Arabic ( اﻟﻌﺮﺑﯿﺔ)
Lesson 1998ASCII and Its Limitations
non-modular JAR
is placed on the **module path** (not classpath), the JVM automatically converts it into an **automatic module**.
Lesson 2515Modular JARs vs Non-Modular JARs at RuntimeLesson 2535What Are Automatic Modules?
Non-modular JAR on classpath
Joins the "unnamed module" (pre-JPMS behavior)
Lesson 2515Modular JARs vs Non-Modular JARs at Runtime
Non-Recursive Monitoring
By default, registering a directory only watches that single directory—not its subdirectories.
Lesson 2102Closing WatchService and Limitations
Non-serializable by nature
fields you know would cause `NotSerializableException`
Lesson 2132Marking Fields as transient
Normal unwinding
`methodB` finishes → frame popped → control returns to `methodA` at the line after `methodB()`.
Lesson 749Normal Stack Unwinding
Normalization
Converting to uppercase/lowercase and finding unique values
Lesson 1483Using distinct After Transformations
NoSuchFileException
is thrown when you try to list a directory that simply doesn't exist on the filesystem.
Lesson 2082Error Handling: NoSuchFileException and AccessDeniedException
NoSuchMethodException
occurs when you try to access a method that doesn't exist.
Lesson 811ReflectiveOperationException Hierarchy
Not documenting clone behavior
Always specify whether your `clone()` performs shallow or deep copying in your class documentation.
Lesson 570Clone Best Practices and Common Pitfalls
Not guaranteed
The method makes a "best effort" but may skip zero bytes in some cases
Lesson 1910The skip(long) Method for Skipping Bytes
Not Thread-Safe
Like most collection classes (except the concurrent ones), `ArrayDeque` is not synchronized for concurrent access.
Lesson 1202What is ArrayDeque? Overview and PurposeLesson 1247Why Collections Need Synchronization
Not truly behavioral contracts
Marker interfaces are pure metadata; empty abstract classes imply (incorrectly) that there might be shared code.
Lesson 530Marker Interfaces vs Empty Abstract Classes
Notify requesters
that their work wasn't completed
Lesson 2771Return Values: Handling Unexecuted Tasks
Null arguments without handling
Passing `null` for `%s` prints "null" (usually fine), but `%d` with null crashes.
Lesson 2233Common Formatting Patterns and Pitfalls
Null check required
You must check if the resource was actually initialized
Lesson 850The Classic finally Block Pattern
Null for primitives
You pass `null` for a `boolean` parameter
Lesson 2349Type Safety and IllegalArgumentException Risks
Null handling
One `null` is allowed (subsequent nulls are duplicates)
Lesson 1550Collectors.toSet(): Collecting into a Set
Null permitted
Both null keys and null values are allowed
Lesson 997HashMap: Key-Value Pairs with Hashing
Null-returning
"I'll try to get $50, but if it fails, I'll handle it quietly.
Lesson 1178Exception-Throwing vs Null-Returning Methods
Number of parameters
(one method takes 2 parameters, another takes 3)
Lesson 207Method Overloading Fundamentals
NumberFormatException
if the content isn't numeric → skip the invalid line, continue
Lesson 756The Need for Multiple catch Blocks

O

O(1) average-case performance
for `get`, `put`, and `remove` operations.
Lesson 1141TreeMap vs HashMap: When to Choose Sorted Maps
O(1) average-time complexity
for basic operations—blazingly fast.
Lesson 981HashSet vs TreeSet: Performance vs Ordering Trade-offs
O(1) guaranteed
Array access is constant time, always
Lesson 603EnumMap Performance: Array-Based Implementation
O(1) on average
, even though individual calls can be O(n).
Lesson 1016Amortized Analysis: Why O(1) Despite Occasional O(n)
O(1) space
Only swaps elements in-place, no temporary arrays
Lesson 1236Rotate Internals: Reversal Algorithm
O(N log K)
time complexity instead of O(N log N) for full sorting, and you only use **O(K) space** instead of O(N).
Lesson 1191Using PriorityQueue for Top-K Problems
O(n log n)
time complexity in the worst case and is **stable** (maintains equal elements' relative order).
Lesson 1364Sorting Performance Considerations
O(n) linear time complexity
, where n is the number of elements.
Lesson 1530Performance Characteristics of count, min, and max
O(n²)
in worst cases (though this is rare with modern implementations).
Lesson 1364Sorting Performance ConsiderationsLesson 1565Performance Characteristics of joining()
O(n²) time complexity
for n concatenations.
Lesson 2185Why StringBuilder and StringBuffer Exist
Object reference finals
May *appear* to work initially, but the JVM can optimize based on the assumption the reference never changes.
Lesson 2357Final Fields: Modification Restrictions and Workarounds
Object-oriented design
It feels more natural to ask a list to sort itself rather than hand it to an external utility.
Lesson 1357Sorting Lists with List.sort()
Obtain the Method object
using `getDeclaredMethod()` (which can see private methods)
Lesson 2363Invoking Private Methods with setAccessible
Occasional use
For one-time initialization, configuration loading, or infrequent operations (like framework setup), the milliseconds lost are irrelevant compared to I/O, network, or database operations.
Lesson 2350Performance Costs of Reflective Invocation
Occupied
One or more entries already live in this bucket (a collision scenario)
Lesson 1108put() Operation: Insertion Process
Off-by-one awareness
`count < 5` runs 5 times (0–4); `count <= 5` runs 6 times (0–5)
Lesson 158Loop Control Variables and Counting Patterns
OffsetDateTime
stores a **fixed offset** from UTC (like `+05:00` or `-08:00`).
Lesson 1870OffsetDateTime vs ZonedDateTime
On macOS/Linux
You'll typically edit your shell configuration file (`.
Lesson 6Adding Java to Your System PATH
On Windows
You'll add something like `C:\Program Files\Java\jdk-17\bin` to your PATH variable through System Properties.
Lesson 6Adding Java to Your System PATH
One-Time Use
If you only reference a class once or twice in a large file, typing the FQN inline can be clearer than adding an import for a single occurrence.
Lesson 678When to Use FQNs vs Import StatementsLesson 1384stream() Method on Collections
Only declared methods
nothing inherited from superclasses
Lesson 2334Getting Declared Methods: Class-Specific Methods Only
Only partial state updates
where just a few lines need protection
Lesson 2660When to Use Synchronized Methods
Open hierarchies
(without `final`) invite extension—think frameworks where users create custom subclasses.
Lesson 431Design Decisions: When to Use final
OpenJDK
– The completely free, open-source version that Oracle JDK is based on.
Lesson 3Choosing a JDK Distribution: Oracle, OpenJDK, and Others
Operations with side effects
logging, I/O, or state changes
Lesson 1784Choosing Between orElse and orElseGet
operator precedence
rules, just like the order of operations you learned in math class.
Lesson 91Operator Precedence: Multiplication Before AdditionLesson 112Chaining Comparisons and Operator Precedence
Optimization clarity
Though modern JVMs optimize well regardless, `final` clearly signals your design intention.
Lesson 427The final Keyword on Classes
Optimization opportunity
Because intermediate operations are lazy, Java can optimize the pipeline.
Lesson 1403Intermediate Operations Are Lazy
Option 1
Use a single-type import for the class you'll use most:
Lesson 670Import Precedence and Handling Name Conflicts
Option 1: Type-first syntax
Lesson 234Array Declaration Syntax
Option 2
Use fully qualified names when you need the "other" class:
Lesson 670Import Precedence and Handling Name Conflicts
Option 2: Variable-name syntax
Lesson 234Array Declaration Syntax
Option 3
Avoid wildcard imports entirely and be explicit about every import.
Lesson 670Import Precedence and Handling Name Conflicts
Optional "hook" methods
(concrete but meant to be overridden)
Lesson 529The Template Method Pattern with Abstract Classes
Oracle JDK
– The original from Oracle Corporation.
Lesson 3Choosing a JDK Distribution: Oracle, OpenJDK, and Others
Order doesn't matter
Unlike multiple `catch` blocks, the order of types in a multi-catch doesn't affect compilation
Lesson 761Multi-Catch Syntax (Java 7+)
Order guarantee
The iterator order **must** match the queue's retrieval order
Lesson 1173Queue Iteration Order and Iterator Behavior
Order of parameter types
(one takes `(int, String)`, another takes `(String, int)`)
Lesson 207Method Overloading Fundamentals
Order parameters logically
Required information first, optional details later.
Lesson 324Choosing Constructor Overload Signatures
Order preserved
The returned list matches the input collection's order
Lesson 2758invokeAll: Executing Multiple Callables
Ordered Collection
Elements maintain insertion order.
Lesson 969List Interface: Ordered Collections with Duplicates
Ordering queries
Find elements before or after a specific value
Lesson 974SortedSet and SortedMap: Ordered Collections
Ordering sensitivity
In parallel streams, `distinct()` can be expensive because threads must coordinate to maintain a shared state of "seen" elements.
Lesson 1447The Stateful Nature of distinct
ordinal
(its position in the enum declaration, starting at 0) serves as the array index.
Lesson 603EnumMap Performance: Array-Based ImplementationLesson 1881dayOfWeekInMonth: Nth Occurrence of a Day
ORM Mapping
Annotations like `@Entity`, `@Column`, and `@Id` let frameworks translate Java objects to database rows.
Lesson 2387Practical Use Cases: Frameworks and Custom Processing
Other locales
Could be `ISO-8859-1`, `Shift_JIS`, `GBK`, etc.
Lesson 2005Default Charset and Platform Dependency
Other structures
that better fit your domain needs
Lesson 1585Collecting to Different Data Structures per Partition
Other useful adjusters
include `firstDayOfNextMonth()`, `firstDayOfNextYear()`, and day-of-week adjusters like `next()`, `previous()`, and `nextOrSame()` for finding specific weekdays.
Lesson 1877Using Built-in Adjusters from TemporalAdjusters
OutputStream
is the abstract superclass for all classes that write bytes.
Lesson 1904The InputStream and OutputStream Abstract Classes
outside
(at the end of the chain), it reverses *everything*, including where nulls land.
Lesson 1355Order of Operations: reversed() vs Null MethodsLesson 2179When Strings Are NOT Interned
Outside the package
*Only subclasses* can access the `protected` member, and only through inheritance
Lesson 706Protected Members and Package Boundaries
Overall time complexity
O(n) where n is total stream size
Lesson 1448Performance Implications of distinct on Large Streams
Overlaps
When clocks fall back (e.
Lesson 1852Daylight Saving Time Transitions
Overloaded methods
accept different functional interfaces with similar lambda signatures
Lesson 1731Target Type from Cast Expressions
Overridden methods
When your subclass replaces a method but still wants to run the parent's logic first
Lesson 403The super Keyword: Accessing Superclass MembersLesson 442Dynamic Dispatch with Upcast References
Overriding
and **overloading** are both ways to have multiple methods with the same name, but they serve different purposes:
Lesson 416Overriding vs OverloadingLesson 518Static Methods vs Default Methods: Key Differences

P

Package access
Any class in the same package can access `protected` members (just like package-private)
Lesson 330protected: Inheritance and Package Access
Package-level tidiness
You want to avoid cluttering the package with helper classes that outsiders shouldn't typically use directly
Lesson 619Static Nested Classes vs Top-Level Classes
Package-Private Constructor
Only classes in the same package can instantiate—useful for internal frameworks.
Lesson 334Access Modifiers on Constructors
Package-private methods
(no modifier): Classes in the same package can call these—useful for closely related classes
Lesson 333Access Modifiers on Methods
Parallel
(two threads): Thread 1 computes `10 + 5 = 15`, Thread 2 computes `10 + 3 + 2 = 15`, then combine: `15 + 15 = 30`
Lesson 1507Identity Element Requirements: Associativity and Neutrality
Parallel composition
(which you'll learn about with `thenCombine`) launches independent operations simultaneously and combines their results.
Lesson 2824Performance Considerations: Sequential vs Parallel Composition
Parallel execution
Both futures start immediately and run independently
Lesson 2825Understanding thenCombine: Combining Independent Futures
Parallel iteration
over multiple collections
Lesson 1296Enhanced For Loop vs Traditional For Loop
Parallel processing
Divide computational work across multiple threads to utilize multiple CPU cores.
Lesson 2560When to Use Threads in Java
Parameter
– Exactly one: `ObjectOutputStream`
Lesson 2140The writeObject Method Signature
Parameter Passing
The simplest alternative is passing context data explicitly through method parameters.
Lesson 2641ThreadLocal Alternatives and When to Avoid It
Parameter types match
exactly (same number, same types, same order)
Lesson 2406@Override: Compiler Verification
Parameters count too
Method parameters follow the same rule
Lesson 634Accessing Local Variables from Local Classes
Parentheses
`()` — always evaluated first
Lesson 112Chaining Comparisons and Operator Precedence
Parsing and validation
If input data is malformed, the caller might ask for corrected input or skip that record.
Lesson 789When to Use Checked Exceptions: Recoverable Conditions
Partial cleanup
Release some resources while letting others handle the error
Lesson 745Re-throwing Exceptions After Partial Handling
Partial implementation helps
Some methods can be fully implemented once for all subclasses
Lesson 525Abstract Classes: Is-A with Shared Implementation
Partial iteration
(skip elements, custom step sizes)
Lesson 1296Enhanced For Loop vs Traditional For Loop
Partial progress illusion
Some threads continue working normally while others silently deadlock, making diagnosis challenging.
Lesson 2694Deadlock with Multiple Threads and Resources
Partitioning
splitting data based on true/false conditions
Lesson 1522Why collect Is the Gateway to Advanced Collectors
Pass a Class object
(advanced, uses reflection—not yet covered in detail):
Lesson 864Restrictions: Cannot Instantiate Type Parameters with new T()
PATH
is like a shortcut list your operating system maintains.
Lesson 6Adding Java to Your System PATH
Path and Query
Character classes include URL-safe characters
Lesson 2284URL and URI Matching
Pattern
takes a regular expression string (like `"\\d+"` for one or more digits) and compiles it into an optimized, reusable form.
Lesson 2244Introduction to Pattern and MatcherLesson 2466Compiling a Module with javac
Patterns are complex
with many captures
Lesson 2275Named Groups vs Numbered Groups
Per-thread context
storing user sessions, database connections, or transaction IDs that should be isolated per thread
Lesson 2633What is ThreadLocal and Why It Exists
Perform a modulo operation
(wrapping around the circular buffer)
Lesson 1208Performance Characteristics: O(1) Operations
Perform inline logic
`employee -> employee.
Lesson 1339Comparator.comparing() with Lambda Expressions
Performance boost
Processing stops as soon as the limit is satisfied.
Lesson 1414Intermediate Short-Circuiting: limit Operation
Performance Constraints
Watching many directories simultaneously can strain system resources.
Lesson 2102Closing WatchService and Limitations
Performance is identical
to manual iteration—no overhead
Lesson 1292How the Enhanced For Loop Works Internally
Performance optimizations
The JVM optimizes `String` and wrapper classes aggressively (string pooling, unboxing).
Lesson 429final Classes in the JDK: String and Wrappers
Performance problems
Objects with `finalize` methods survive longer in memory and slow down garbage collection
Lesson 300The finalize Method (Deprecated)Lesson 574The finalize Method: Legacy Cleanup Mechanism
Performance-critical repeated concatenation
Use `StringBuilder`
Lesson 2243Text Blocks vs String Concatenation
Performance-sensitive code
(slightly faster, though rarely significant)
Lesson 2275Named Groups vs Numbered Groups
Period
works with **date-based types** (those containing date components):
Lesson 1865Adding Duration and Period to Temporal Objects
Periodic interrupt checks
Structure your code to check `Thread.
Lesson 2607Interruption and Non-Interruptible Blocking
PermGen
(Permanent Generation), a fixed-size memory area separate from the main heap.
Lesson 2182Intern Pool Location: PermGen vs Metaspace
Persistence frameworks
(Hibernate, JPA) need to access private fields in entity classes
Lesson 2492Unconditional opens: Opening Packages to All Modules
Phase 1
Convert third-party JARs to automatic modules (place on module path, add `Automatic-Module- Name` if you control the JAR)
Lesson 2543Migration Strategy: From Automatic to Explicit Modules
Phase 3
Replace automatic modules with explicit versions:
Lesson 2543Migration Strategy: From Automatic to Explicit Modules
Phase 4
Validate with `jdeps` that all automatic modules are eliminated
Lesson 2543Migration Strategy: From Automatic to Explicit Modules
Phone number formats
Verifying the entire string matches your expected pattern
Lesson 2256Using matches() for Full String Validation
pipeline
of transformations, where each step processes the value if present, or safely short-circuits if absent.
Lesson 1803Chaining Multiple map OperationsLesson 2800Chaining Multiple thenApply Calls
Pipeline position
Placing `distinct()` early in a pipeline (after narrowing filters) can reduce memory usage compared to placing it late.
Lesson 1447The Stateful Nature of distinct
Pitfall #2
Using `LocalDateTime` when you actually need `ZonedDateTime`.
Lesson 1903Migration Checklist and Common Pitfalls
Pitfall #3
Replacing `SimpleDateFormat` patterns without checking symbol differences (some symbols changed meaning).
Lesson 1903Migration Checklist and Common Pitfalls
Pivot-Based Traversal
Position the iterator at a specific index using `listIterator(index)`, then explore both directions from that pivot point.
Lesson 1289Bidirectional Iteration Patterns
Places the entry
in the appropriate bucket of the new array
Lesson 1128Recalculating Hash Indices After Resizing
Plan replacement strategies
for each dependency on internal APIs
Lesson 2530Using --add-exports and --add-opens as Temporary Workarounds
Platform abstraction
Works consistently across Windows, Linux, and macOS
Lesson 2025Introduction to NIO.2 and the Path Interface
Platform Behavior Differences
Different file systems have varying reliability.
Lesson 2102Closing WatchService and Limitations
Platform differences
Windows, Linux, and macOS have different scheduler behaviors
Lesson 2596Sleep Precision and Guarantees
Platform specificity
`jlink` images are platform-dependent; distributing to Windows, Linux, and macOS requires three separate builds.
Lesson 2552Comparing jlink Images to Traditional Deployments
Platform-independent
line endings with `newLine()`
Lesson 1986Complete Example: Reading and Writing Text Files
Platform-specific builds
Create separate images for Windows, macOS, and Linux since native binaries differ
Lesson 2551Distributing Custom Runtime Images
Plugin systems
Execute methods from dynamically loaded classes
Lesson 2341Overview of Method.invoke and Its Purpose
Polling with backoff
If your thread checks for a condition repeatedly, sleeping between checks prevents burning CPU cycles unnecessarily.
Lesson 2590The Purpose of Thread.sleep
Polymorphism
| Participates in dynamic dispatch | No polymorphism—resolved at compile-time |
Lesson 518Static Methods vs Default Methods: Key Differences
Pool size
More generous limits encourage safer use of `intern()`
Lesson 2182Intern Pool Location: PermGen vs Metaspace
Poor API Design
The API was confusing and counterintuitive.
Lesson 1895Problems with java.util.Date and java.util.Calendar
Poor cache performance
Nodes are scattered across memory
Lesson 1227Performance Characteristics of Sorting
Poor hashCode()
All keys hash to the same bucket → degrades to O(n) for that bucket's search
Lesson 1112Performance Characteristics: O(1) Average Case
Poor Scalability
Thread creation itself is expensive (milliseconds per thread).
Lesson 2709The Problem with Manual Thread Management
Port
`:[0-9]{1,5}` is optional (`?
Lesson 2284URL and URI Matching
Portability
Your code behaves identically on Windows, Mac, and Linux
Lesson 2044Character Encoding and Charset Parameters
Positional Access
Retrieve elements by their numeric index:
Lesson 969List Interface: Ordered Collections with Duplicates
Positive `n`
Adds `n` spaces to the beginning of each line
Lesson 2221The indent Method: Adding Leading Whitespace
Positive distance
→ elements rotate **to the right** (toward the end)
Lesson 1235Rotate with Positive and Negative Distances
Positive int
(any positive number, typically 1): "I come *after* the other object"
Lesson 1312The compareTo Method Signature
Positive limit
The pattern is applied at most `limit - 1` times.
Lesson 2208Limit Parameter in split(): Controlling Array Size
Positive Lookahead `(?=...)`
Asserts that what follows matches the pattern
Lesson 2302Understanding Zero-Width Assertions
positive lookbehind
is a zero-width assertion that checks whether a certain pattern exists immediately *before* the current position in the string.
Lesson 2305Positive Lookbehind Syntax: (?<=...)Lesson 2308Practical Lookbehind: Currency and Units
Positive Lookbehind `(?<=...)`
Asserts that what precedes matches the pattern
Lesson 2302Understanding Zero-Width Assertions
Positive value
(any positive int): `this` object is **greater than** the argument
Lesson 1313Return Values: Negative, Zero, PositiveLesson 1319The compareTo Method Signature and Return Values
Postfix (`i++`)
Use the current value **first**, then increment
Lesson 97Prefix vs Postfix: Evaluation Order
Postfix (`x--`)
The current value is used in the expression *first*, then the variable is decremented afterward.
Lesson 99Using Decrement in Expressions
Postfix (`x++`)
The current value is used in the expression *first*, then increment happens
Lesson 98Using Increment in Expressions
Practical demonstration
Shows why generics matter (imagine needing `StringArrayList`, `IntegerArrayList`, etc.
Lesson 900ArrayList<E> as the Canonical Generic Collection
Pre/post processing
perform actions before entering or after leaving directories (like calculating directory sizes)
Lesson 2089Files.walkFileTree for Complex Traversals
Precision for floats
Number of decimal places
Lesson 2020Format Specifiers: %s, %d, %f, and More
Predicate
Tests a condition and returns `true` or `false` (you've used this with `filter` operations)
Lesson 1629Common Functional Interfaces in java.util.function
Predictable JSON/XML serialization
Keeping fields in insertion order
Lesson 1151When to Use LinkedHashMap vs HashMap
Predictable resource usage
You control exactly how many threads exist
Lesson 2720newFixedThreadPool: Creating a Fixed-Size Thread Pool
Prefer generics
Use parameterized collections to maintain compile-time type safety
Lesson 799ClassCastException and Type Safety
Prefer parameters over capture
When possible, pass data as parameters rather than capturing from the enclosing scope:
Lesson 1726Best Practices for Variable Capture
Prefer single-member imports
over wildcard imports (`import static Math.
Lesson 675Static Import Anti-Patterns and Best Practices
Prefer static over non-static
unless you specifically need access to the outer class's instance members
Lesson 621Common Use Cases and Best Practices
Prefix (`--x`)
The variable is decremented *first*, then the new value is used in the expression.
Lesson 99Using Decrement in Expressions
Prefix (`++i`)
Increment **first**, then use the new value
Lesson 97Prefix vs Postfix: Evaluation Order
Prefix (`++x`)
Increment happens *first*, then the new value is used in the expression
Lesson 98Using Increment in Expressions
Preserve the signal
for code higher up the call stack
Lesson 2598Restoring Interrupt Status in catch Blocks
Preserves structure
Existing indentation differences between lines remain intact
Lesson 2221The indent Method: Adding Leading Whitespace
Preserving the package structure
internally
Lesson 684What Is a JAR File?
Preserving User Intent
When users select multiple items from a list (think checkboxes), you want to remember the selection order.
Lesson 1081Use Cases for Insertion Order
Prevent future execution
If the task hasn't started yet (still queued), it's removed from the queue and never runs.
Lesson 2744cancel(): Attempting to Stop Running Tasks
Prevent starvation
Avoid blocking the common pool with long-running I/O tasks
Lesson 2791Providing a Custom Executor to runAsync
Preventing split packages
is critical for maintaining a clean architecture
Lesson 2524Migration Strategy: When to Use Module Path vs Classpath
Prevents accidental bugs
no setter methods means no one can corrupt your data
Lesson 727Immutability and final: Defensive Access Control
Prevents errors
no manual `compare()` implementation mistakes
Lesson 1337Introduction to Comparator Factory Methods
Prevents new task submissions
(just like `shutdown()`)
Lesson 2770shutdownNow(): Forcing Immediate Termination
Prevents resource exhaustion
Controlled concurrency
Lesson 2712Thread Pools: Reusing Threads for Efficiency
Prevents resource leaks
Resources are *guaranteed* to close, eliminating a major source of bugs
Lesson 829Why AutoCloseable Matters
Prevents unintended reuse
You won't accidentally reuse a variable for a different purpose later
Lesson 193Best Practices for Variable Scope
Previous node's `next`
→ now points to the new node instead of the target
Lesson 1024Inserting Elements in the Middle
Price Monitoring
In financial applications, maintaining sorted price points and efficiently finding the nearest buy/sell prices using `lower()` and `higher()`.
Lesson 1101TreeSet as NavigableSet: Practical Applications
Primitive fields
get their type's default: `0` for numbers, `false` for booleans, `'\u0000'` for chars
Lesson 2127Adding Fields to a Serializable Class
Primitive mismatches
You pass `int` when `long` is required (no automatic widening)
Lesson 2349Type Safety and IllegalArgumentException Risks
Primitive streams are different
Since `IntStream`, `LongStream`, and `DoubleStream` work with primitive types, they already know exactly what array type to create.
Lesson 1499Primitive Streams and toArray()
Primitive variables
get sensible "zero" defaults:
Lesson 280Default Values: Primitives vs References
Principle of Least Privilege
means giving each part of your code the minimum level of access it needs to do its job—nothing more.
Lesson 337The Principle of Least PrivilegeLesson 722Default to Most Restrictive: The Principle of Least Privilege
Prioritize by risk
Convert high-churn or security-critical dependencies first
Lesson 2543Migration Strategy: From Automatic to Explicit Modules
Priority inversion
occurs when a high-priority thread becomes blocked waiting for a resource held by a low-priority thread.
Lesson 2631Priority Inversion and Starvation Risks
PriorityQueue
orders elements based on their **priority**.
Lesson 1183What Is a PriorityQueue?
Private Constructor
Prevents external instantiation.
Lesson 334Access Modifiers on Constructors
Private constructors
prevent instantiation
Lesson 392Real-World Examples: Java Standard Library
Private static methods
Called by static or default methods, cannot use `this`
Lesson 520Private Methods in Interfaces: Java 9 Introduction
Private visibility
Only callable within the interface itself
Lesson 522Private Static Methods in Interfaces
Problem
Implementing `compareTo` based on one field but `equals` based on another.
Lesson 1327Common compareTo Mistakes and How to Avoid Them
Problem scenario
You need a transformed value or a fallback:
Lesson 1797Side Effects with ifPresent: When to Use vs Alternatives
Problematic libraries
– those using deep reflection, split packages, or internal JDK APIs
Lesson 2525Assessing Your Application's Readiness for Modules
Process in arrival order
Tasks that should be handled first-come, first-served (like print job scheduling or BFS)
Lesson 1218Stack vs Queue Trade-offs in Problem Solving
Process innermost/most-recent first
Nested structures where you need to complete the innermost level before the outer (like expression evaluation or DFS)
Lesson 1218Stack vs Queue Trade-offs in Problem Solving
Process repeats
in the calling method
Lesson 751The Search for a Handler
Processing large volumes
the cumulative cost of boxing millions of primitives is significant
Lesson 1698When to Use Primitive Specializations vs Generics
Producer Extends
If a collection is *producing* values for you to read (you're taking items *out*), use `<?
Lesson 939The PECS Principle: Producer Extends, Consumer Super
Produces a compile-time error
if the count is zero or more than one
Lesson 1633Compiler Validation of Single Abstract Method
Producing/transforming
→ `Function<T, R>`
Lesson 1662Consumer vs Function: When Not to Return
Professional packaging
Combine with installer tools (like jpackage) for native installers
Lesson 2551Distributing Custom Runtime Images
Profile-guided optimization
The runtime learns which implementations are most common and optimizes accordingly
Lesson 468Performance Implications of Dynamic Dispatch
programming errors
mistakes in your code's logic that shouldn't happen if the program is written correctly.
Lesson 790When to Use Unchecked Exceptions: Programming ErrorsLesson 812Choosing Between Checked and Unchecked
Project isolation
Different projects can have different dependencies without conflicts
Lesson 691The CLASSPATH Environment Variable
promotes
(widens) the smaller type to match the larger one before performing the operation.
Lesson 83Mixed-Type Arithmetic and Automatic PromotionLesson 89Mixing int and double in Arithmetic Expressions
Propagate it
declare `throws InterruptedException` in your method signature
Lesson 808InterruptedException: Thread Interruption
Protected access matters
You need to share helper methods or fields that shouldn't be public
Lesson 525Abstract Classes: Is-A with Shared Implementation
Protected Constructor
Allows subclasses to call via `super()`, even if they're in different packages, while restricting general instantiation.
Lesson 334Access Modifiers on Constructors
Protocol Buffers
defines schemas in `.
Lesson 2165Alternatives to Java Serialization
Provide
that implementation using `provides.
Lesson 2503Implementing a Service Provider Module
Provide implementations
in separate modules (e.
Lesson 2498The Service Provider Interface (SPI) Pattern
Provide sensible defaults
Create constructors that let users specify only what matters, with reasonable defaults for everything else.
Lesson 324Choosing Constructor Overload Signatures
Provider configuration files
(legacy classpath mechanism, pre-JPMS)
Lesson 2499The java.util.ServiceLoader Class
Provides compiler safety
Prevents accidental addition of extra abstract methods
Lesson 1636When @FunctionalInterface is Optional
Public API stability matters
You're designing a library where backward compatibility is critical (use default methods for evolution)
Lesson 532Decision Criteria: A Practical Checklist
Public Constructor
The default choice for most classes.
Lesson 334Access Modifiers on Constructors
Public methods from interfaces
the class implements
Lesson 2333Getting Methods with getMethods()
Public methods inherited
from superclasses (like `Object`)
Lesson 2333Getting Methods with getMethods()
Public no-arg constructor required
The JVM calls this constructor during deserialization, then invokes `readExternal`
Lesson 2149The Externalizable Interface and Its Contract
Purpose
| Extend behavior of implementations | Provide helper/utility methods |
Lesson 518Static Methods vs Default Methods: Key Differences

Q

Qualified vs Unconditional
Using qualified `opens` (e.
Lesson 2497Security and Design Trade-offs with opens
Quantifier
requiring at least 2 letters for the top-level domain
Lesson 2282Matching Email Addresses with Regex
Query execution errors
Your SQL statement has syntax errors or references tables/columns that don't exist
Lesson 806SQLException: Database Access Errors
Queue
is a collection interface that processes elements in **first-in-first-out (FIFO)** order—just like a line at a coffee shop.
Lesson 971Queue Interface: FIFO ProcessingLesson 972Deque Interface: Double-Ended Queue OperationsLesson 1167Queue Interface Overview and FIFO Semantics
Queued tasks continue
tasks waiting in the queue still get executed
Lesson 2715Graceful Shutdown: The shutdown Method
Quick fix when stuck
Most IDEs let you stop a running program (often a red square button), or press `Ctrl+C` in the terminal.
Lesson 163Infinite Loops: Intentional and Accidental
Quick identification trick
Ask yourself, "Could I chain another operation after this?
Lesson 1401Identifying Operation Types in Real Code
Quick one-off parsing
where readability isn't critical
Lesson 2275Named Groups vs Numbered Groups
Quicksort
Pick a pivot, partition, sort each partition recursively
Lesson 233When to Use Recursion: Tree Traversal and Divide-and-Conquer

R

Random access is O(1)
The sorting algorithm can instantly jump to any element by index
Lesson 1227Performance Characteristics of Sorting
Random access is O(n)
To reach element [i], you must traverse i nodes from the head
Lesson 1227Performance Characteristics of Sorting
Random generation
– Produce random or computed values
Lesson 1665What is Supplier<T> and When to Use It
Range views
Get a subset of elements between two values
Lesson 974SortedSet and SortedMap: Ordered Collections
Raw type (`List`)
Abandons type safety entirely.
Lesson 928The Unbounded Wildcard: ? Basics
Read the error carefully
it names the missing module
Lesson 2479Diagnosing Missing requires Declarations
Read the line number
and look at that line in your code
Lesson 14Understanding Compilation Errors
Read-modify-write operations complete atomically
from the program's perspective (no other code can intervene)
Lesson 2649Why Single-Threaded Code Doesn't Have These Issues
read-only
or **immutable**—you can view their contents but can't add, remove, or change elements.
Lesson 802UnsupportedOperationException in CollectionsLesson 2601Checking Interruption Status: isInterrupted()
Readability establishment
Only modules connected in the graph can read each other
Lesson 2470Module Graph and Dependencies at Runtime
Readability suffers
from deeply nested collector chains
Lesson 1623When to Write Custom Collectors vs Compose Existing Ones
Readers and writers
Can operate concurrently in most cases
Lesson 1160ConcurrentHashMap Overview: Lock Striping Architecture
Reading
from both is possible, but raw types return `Object` with no warnings, while wildcards explicitly acknowledge the unknown type.
Lesson 887Raw Types vs Unbounded WildcardsLesson 936Comparing extends vs super WildcardsLesson 1961Why Character Streams Exist: The Encoding Problem
Reading all other modules
(both explicit and automatic)
Lesson 2535What Are Automatic Modules?
Reading configuration files
or moderate-sized data files
Lesson 1935Default Buffer Size: 8KB Explained
Reading is allowed
The local class can read these variables freely
Lesson 634Accessing Local Variables from Local Classes
Reading is safe
because anything you pull out can safely be treated as `Object` (Java's universal supertype).
Lesson 929Wildcard Capture and Reading from <?> CollectionsLesson 932Why You Cannot Write to <? extends T> Collections
Reads all modules
Automatically `requires` every other module it can see
Lesson 2515Modular JARs vs Non-Modular JARs at Runtime
Reads all other modules
The unnamed module can access all exported packages from named modules on the module path
Lesson 2469Unnamed Modules and Compatibility
Real example
Java's `String` class is `final`.
Lesson 428Use Cases for final Classes
Real-time or latency-sensitive systems
– Where microseconds count
Lesson 755Performance Impact of Unwinding
Real-time requirements
When another process needs to read the data immediately
Lesson 1931Flushing Output Streams
Reassignment operators
inside lambdas: `=`, `++`, `--`, `+=`, etc.
Lesson 1721Attempting to Modify Captured Variables
Rebuilds bucket structures
(linked lists or trees) as needed
Lesson 1128Recalculating Hash Indices After Resizing
Recalculates the index
using the new capacity
Lesson 1128Recalculating Hash Indices After Resizing
Receives
tasks submitted via the Executor interface
Lesson 2712Thread Pools: Reusing Threads for Efficiency
Recoloring
flips node colors (red ↔ black) to restore rule compliance, often combined with rotations.
Lesson 1137Red-Black Tree Internals: Balancing Operations
Recompile and verify
the error disappears
Lesson 2479Diagnosing Missing requires Declarations
Reconstruct objects
Use `Constructor.
Lesson 2389Serialization and Object Persistence
Recovery code
What to do when this exception occurs
Lesson 730The catch Block: Handling Specific Exception Types
Recovery strategies differ
If calling code needs to handle different business errors distinctly, custom types make sense
Lesson 821Best Practices: Avoiding Exception Overuse
Recursive case
The method calls itself with a simpler or smaller input, moving toward the base case
Lesson 224What is Recursion? A Method Calling ItselfLesson 227Example: Computing Factorial Recursively
Recursive traversal
For each module encountered, parse its `module-info.
Lesson 2470Module Graph and Dependencies at Runtime
Recursive version
(from lesson 227):
Lesson 232Converting Recursion to Iteration
Recursively resolves
all `requires` directives, adding modules to the graph
Lesson 2476The Readability Graph
Reduce coupling
between classes (they depend on less)
Lesson 722Default to Most Restrictive: The Principle of Least Privilege
Reduce the problem size
Make progress toward the base case
Lesson 226The Recursive Case: Breaking Down the Problem
Reduced errors
No need to understand every thread pool parameter upfront
Lesson 2719The Executors Factory Class Overview
Reduces bugs
Variables can't be accidentally modified outside their intended context
Lesson 193Best Practices for Variable Scope
Reduces resource consumption
Bounded number of threads
Lesson 2712Thread Pools: Reusing Threads for Efficiency
Redundant service calls
Calling multiple replicas of the same service and using whichever responds fastest
Lesson 2767Use Cases: invokeAll vs invokeAny
Reentrancy
means a lock can be acquired *multiple times* by the *same thread* that currently holds it.
Lesson 2671What Is Reentrancy?Lesson 2672Intrinsic Locks Are Reentrant by Default
Refactor if needed
If you later discover you need another bound, add it then—don't guess ahead of time
Lesson 927Common Pitfalls: Overly Restrictive Bounds
Refactoring becomes risky
Renaming classes, methods, or fields can break reflective code without warning
Lesson 2396Maintaining Code with Reflection
Refactoring protection
When a superclass method signature changes, the compiler alerts you immediately
Lesson 2414Built-In Annotations: When and Why to Use Each
Refactoring safety
IDEs can rename all uses of `SHIPPED` reliably; renaming a magic number is error-prone.
Lesson 578What Are Enums and Why They Matter
reference
(the memory address pointing to the object), not the object itself.
Lesson 198Pass-by-Value Semantics in JavaLesson 296Stack vs Heap: References and Objects
Reference Equality (`==`)
Checks if two references point to the *exact same object* in memory—like asking "Are these two variables pointing to the same box?
Lesson 541The equals Method: Reference vs Logical Equality
Reference returned
`new` returns a reference to the newly created object
Lesson 313Creating Objects: Using new with Constructors
Reference variables
(any object type, including arrays and `String`) default to **`null`**.
Lesson 280Default Values: Primitives vs References
Reflection overhead
Every call to `getAnnotation()` requires metadata lookup, type instantiation, and proxy creation
Lesson 2441Retention Policy and Performance Implications
Reflection preparation
The `Class` object is the gateway to Java's reflection capabilities (advanced topic)
Lesson 571The getClass Method: Runtime Type Information
Reflection-friendly
All packages are open for deep reflection
Lesson 2515Modular JARs vs Non-Modular JARs at Runtime
Reformatting
Join processed lines with different delimiters
Lesson 2224Combining lines with Stream Operations
Regular import
Brings a *class* into scope so you don't need the package name
Lesson 376Understanding static Import Syntax
reified
they remember their component type at runtime and check every element assignment.
Lesson 897Cannot Create Generic ArraysLesson 1500Common Pitfalls with toArray(Object[]::new)
Reinsert the entry
into the appropriate bucket in the new array
Lesson 1126The Rehashing Process: Doubling Capacity
Relational operators
`<`, `>`, `<=`, `>=` — comparisons
Lesson 112Chaining Comparisons and Operator Precedence
Relative paths
specify a location relative to some starting point (usually the current working directory).
Lesson 2027Absolute vs Relative Paths
Reliability
The classpath allows duplicate classes and missing dependencies to fail at runtime.
Lesson 2517Module Path Introduction: A New Way to Organize Code
Reliable configuration
Missing dependencies are detected at compile-time and startup, not randomly at runtime.
Lesson 2461Introduction to JPMS and the Module System
Remember
`super(args)` must be the **first statement** in the constructor, just like `this()`.
Lesson 408Calling Specific Superclass Constructors with super(args)Lesson 2297Predefined Character Classes: \d, \w, \s
Removal after locating
O(1) — just pointer updates
Lesson 1041Time Complexity: Removal Operations
Removal from end
O(1) — no shifting needed
Lesson 1041Time Complexity: Removal Operations
Remove `final`
Enable deep copying but lose immutability guarantees
Lesson 569Final Fields and clone: The Conflict
Remove duplicate dots
– Multiple consecutive dots collapse to one
Lesson 2537Automatic Module Naming from JAR Filename
Remove leading/trailing dots
– Clean up the edges
Lesson 2537Automatic Module Naming from JAR Filename
Remove operations fail
Even though an element is logically present, `remove()` can't find it.
Lesson 558HashSet Breakage: The Same Root Cause
Remove the `.jar` extension
– `commons-lang3-3.
Lesson 2537Automatic Module Naming from JAR Filename
Remove wildcard imports
import specific members instead of `import static Math.
Lesson 380Name Conflicts and Ambiguity in static Imports
Removing a field
The serialized stream contains data for a field that no longer exists in the class.
Lesson 2128Removing or Renaming Fields: Breaking Changes
Removing fields
Old serialized data contains fields the new class doesn't recognize
Lesson 2164Versioning Problems and Class Evolution
Rename methods
if overloading becomes too complex
Lesson 215Common Overloading Pitfalls and Ambiguity
Renaming a field
Java sees the old field name in the stream but can't find it in the current class.
Lesson 2128Removing or Renaming Fields: Breaking Changes
Repeated pagination
Multiple queries with increasing offsets waste work
Lesson 1469Performance Implications of skip
Represent historical data
where the offset at that moment is what counts, not future rule changes
Lesson 1867Introduction to OffsetDateTime
Reproducibility
Use the same random "seed" to get identical shuffles every time (great for testing or debugging)
Lesson 1232Providing a Custom Random Source to shuffle
Request arrives
→ Store context in `ThreadLocal`
Lesson 2639Common Use Cases: User Context and Request Scoping
Request completes
→ **Always** call `remove()` to prevent leaks
Lesson 2639Common Use Cases: User Context and Request Scoping
Required
When the literal exceeds `int` range (larger than 2,147,483,647 or smaller than -2,147,483,648)
Lesson 57Long Literals and the L SuffixLesson 559The equals-hashCode Contract in DetailLesson 1675BiFunction apply Method and Lambda Syntax
Requires public no-arg constructor
Additional constraint
Lesson 2157Externalizable vs Serializable: Trade-offs and Decision Guide
Reset singletons
Clear private static fields between tests
Lesson 2390Testing: Accessing Private Members
Resource availability
If a resource is locked or unavailable, the caller might wait and retry or queue the operation for later.
Lesson 789When to Use Checked Exceptions: Recoverable Conditions
Resource control
Limit concurrency for database queries or API calls by using a bounded thread pool.
Lesson 2803Using thenApplyAsync with Custom Executor
Resource Exhaustion
Imagine a web server that spawns a thread per request.
Lesson 2709The Problem with Manual Thread Management
Resource management
When you need threads back for other work
Lesson 2742get() with Timeout: Avoiding Indefinite Blocking
Resource Release
The method must release all resources held by the object—file handles, network connections, database connections, etc.
Lesson 823The close() Method Contract
Resource scheduling
The JVM scheduler or OS may favor certain threads over others
Lesson 2705What Is Starvation?
Resources are closed
automatically (in reverse order of declaration)
Lesson 835Combining Try-With-Resources and Finally
Responsive user interfaces
Keep your UI responsive while performing background work.
Lesson 2560When to Use Threads in Java
Retry
with a longer timeout or different strategy
Lesson 2754Timeout-Based Result Retrieval with get(timeout)
Return
a new wrapped result (Stream or CompletableFuture)
Lesson 2805thenApply vs map in Stream API
Return statements
What return type does the method signature declare?
Lesson 1727What Is Target Typing?
Return value matters
Always check how many bytes were actually skipped—it might be fewer than you requested
Lesson 1910The skip(long) Method for Skipping Bytes
Return-value methods
(`offer`, `poll`) are polite: "Is there a table available?
Lesson 1168Queue Core Methods: add, offer, remove, poll
Returns a new future
You get a `CompletableFuture` of the transformed type
Lesson 2797What thenApply Does: Synchronous Transformation
Returns a reference
(a memory address) pointing to that newly allocated space
Lesson 276The new Keyword: Allocating Objects on the HeapLesson 295Object Allocation with new
Returns to `methodB()`
and checks if it has a matching `catch` block
Lesson 750Exception-Driven Stack Unwinding
Returns true or false
`true` if the element was new (put returned `null`), `false` if it was already present (put returned `PRESENT`)
Lesson 1049HashSet add: Calling HashMap put
Reuse existing logic
from one interface without rewriting it
Lesson 500Using super to Call Specific Default Method
Reuse first
If an idle thread is available, it executes the task immediately
Lesson 2723newCachedThreadPool: Elastic Thread Pool for Short Tasks
Richer Metadata Access
You can retrieve detailed file attributes, permissions, ownership, and timestamps with ease.
Lesson 2034Overview of Files Utility Class and Basic Operations
Right rotation (positive distance)
Elements near the end move to the front.
Lesson 1234Collections.rotate: Shifting Elements Circularly
Right side of arrow
The body—what the lambda does or returns
Lesson 1699Lambda Expression Structure: Arrow Notation
Right-click in your class
(or use a keyboard shortcut)
Lesson 347IDE Generation and Refactoring Tools for Accessors
Risk of OutOfMemoryError
with very large datasets
Lesson 1448Performance Implications of distinct on Large Streams
Room
Generates database access code from entity annotations
Lesson 2452What Are Annotation Processors?
root directory
of your JDK installation—the folder that contains subdirectories like `bin`, `lib`, and `include`.
Lesson 5Setting the JAVA_HOME Environment VariableLesson 664Running Packaged Classes
Root elements
`getRootElements()` gives you all top-level types being compiled this round
Lesson 2457The RoundEnvironment and Processing Rounds
Root identification
The module containing your main class becomes the root
Lesson 2470Module Graph and Dependencies at Runtime
Rotations
restructure the tree by pivoting nodes.
Lesson 1137Red-Black Tree Internals: Balancing Operations
Round 1
The compiler invokes your processor with all initial source files.
Lesson 2457The RoundEnvironment and Processing Rounds
Round 2+
If new files were generated, the compiler processes them and calls your processor again with the newly created elements.
Lesson 2457The RoundEnvironment and Processing Rounds
Round status
`processingOver()` tells you if this is the final round
Lesson 2457The RoundEnvironment and Processing Rounds
running
and consuming CPU cycles, but they're stuck in a repetitive pattern of activity.
Lesson 2703Detecting Livelock vs DeadlockLesson 2774isShutdown() and isTerminated() Status Methods
Running tasks finish
tasks currently being processed run to completion
Lesson 2715Graceful Shutdown: The shutdown Method
RUNTIME annotations
are the only ones your reflection code can access using methods like `getAnnotation()`, `getDeclaredAnnotations()`, or `isAnnotationPresent()`.
Lesson 2379Annotation Retention and Runtime Availability
Runtime errors
(also called **exceptions**) are problems that occur *while your program is executing*.
Lesson 15Understanding Runtime Errors
Runtime processing
Happens while your application is executing (using reflection)
Lesson 2453Compile-Time vs Runtime Annotation Processing
Runtime type access
You can call `clazz.
Lesson 898Type Tokens and Reification Workarounds
Runtime type checking
– validating parameters and target classes
Lesson 2378Performance and Security Considerations

S

Safe for downstream operations
– you can immediately use the result in calculations
Lesson 1594Handling Empty Streams with Summing and Averaging Collectors
Safe reentrancy
The thread maintains exclusive access through nested calls
Lesson 2674Lock Acquisition Count: Entry and Exit Tracking
Safer exception handling
Properly preserves original exceptions using suppressed exception mechanism
Lesson 829Why AutoCloseable Matters
Same Class
| **Same Package** | **Subclass** | **Everywhere** |
Lesson 335Comparing Access Levels: A Decision Matrix
Same neighborhood (package)
Everyone can visit your house
Lesson 706Protected Members and Package Boundaries
Same type safety
The compiler still enforces types strictly
Lesson 859Diamond Operator: Type Inference in Constructors
Save
scores to a file for persistence (requires `Serializable`)
Lesson 925Use Case: Combining Comparable and Serializable
Save an object's state
to a file so it persists after your program closes?
Lesson 2103What Is Serialization and Why It Matters
Scalability
Applications can ship with only the JDK modules they need, reducing footprint dramatically.
Lesson 2461Introduction to JPMS and the Module System
Scales to zero
When no tasks arrive, the pool eventually shrinks to zero threads
Lesson 2723newCachedThreadPool: Elastic Thread Pool for Short Tasks
Scatter
Launch multiple threads to work on independent tasks simultaneously
Lesson 2616Common join Patterns: Scatter-Gather
Scenario 1
Exception in try block + exception in `close()` = close exception suppressed
Lesson 840When Suppression Occurs
Scenario 2
No exception in try block + exception in `close()` = close exception propagates normally (no suppression)
Lesson 840When Suppression Occurs
Scenario 3
Multiple resources, exceptions in multiple `close()` calls + exception in try block = all close exceptions suppressed
Lesson 840When Suppression Occurs
Scheduler granularity
Operating systems often schedule in time slices (e.
Lesson 2596Sleep Precision and Guarantees
Scientific calculations
– You need the extra precision
Lesson 46When to Use double Over float
Searching from End
Use `listIterator(list.
Lesson 1289Bidirectional Iteration Patterns
Second `awaitTermination()`
verifies forced shutdown actually worked
Lesson 2775Common Shutdown Patterns and Best Practices
Second downstream collector
– computes another result (e.
Lesson 1609Basic teeing Example: Min and Max in One Pass
Security concerns
Deserializing untrusted data creates vulnerability risks.
Lesson 2111When to Use and Avoid Serialization
Security permission checks
(when SecurityManager is present)
Lesson 2400setAccessible and Security Manager Overhead
Security risks
Java's security model trusts that a `String` behaves like a `String`.
Lesson 429final Classes in the JDK: String and Wrappers
Security violations
You can modify `final` fields, change security credentials, or alter immutable objects
Lesson 2360Performance and Security Implications of Field Access
Security vulnerabilities
can arise from finalization attacks
Lesson 577Deprecation of finalize in Java 9+
Security-sensitive
passwords, API keys, tokens
Lesson 2132Marking Fields as transient
SecurityManager
(legacy) and the **module system** (modern) can block this power when security policies demand it.
Lesson 2365Security Manager and Module System RestrictionsLesson 2400setAccessible and Security Manager Overhead
Self-documenting code
matters more than brevity
Lesson 2275Named Groups vs Numbered Groups
Self-identification
Check your own name or ID
Lesson 2579Thread.currentThread() for Self-Reference
Self-synchronizing
You can detect character boundaries even if you jump into the middle of a stream
Lesson 2000UTF-8: Variable-Length Encoding
Sensible defaults
Thread pools configured for typical use cases
Lesson 2719The Executors Factory Class Overview
Separate concerns
Keep background logging tasks isolated from critical business logic
Lesson 2791Providing a Custom Executor to runAsync
Separate with pipes
Use `|` between exception types, not commas
Lesson 761Multi-Catch Syntax (Java 7+)
Separation of concerns
`Runnable` cleanly separates the *task* from the *thread execution mechanism*.
Lesson 2569Thread vs Runnable: Design Trade-offsLesson 2572Creating a Thread with Runnable
sequential
, meaning elements are processed one after another in encounter order (for ordered collections like List).
Lesson 1384stream() Method on CollectionsLesson 1507Identity Element Requirements: Associativity and Neutrality
Sequential access
means reading or writing bytes in consecutive order from start to finish.
Lesson 1954Disk I/O Latency and Sequential vs Random AccessLesson 2074DirectoryStream Interface Overview
Sequential composition
with `thenCompose` executes operations in order—the second stage *waits* for the first to complete before starting.
Lesson 2824Performance Considerations: Sequential vs Parallel Composition
Sequential processing
is acceptable for your use case
Lesson 1542findFirst: Deterministic Element Selection
sequentially
they process elements one at a time in a single thread, just like a traditional loop.
Lesson 1372Sequential vs Parallel StreamsLesson 2829thenCombine vs thenCompose: Key Differences
Serializable (default)
Someone examines each item, decides how to pack it, writes notes about what it is, then carefully places it.
Lesson 2153Performance Benefits of Externalizable
Serialization
Libraries need to call getters/setters on arbitrary objects
Lesson 2341Overview of Method.invoke and Its PurposeLesson 2438RetentionPolicy.RUNTIME Explained
Serialization libraries
(Jackson, Gson) must read/write private state
Lesson 2492Unconditional opens: Opening Packages to All Modules
Server applications
Handle multiple client requests simultaneously.
Lesson 2560When to Use Threads in Java
Server programs
waiting for client connections indefinitely
Lesson 169Omitting for Loop Components: Infinite Loops
Serves as documentation
Makes your design explicit
Lesson 1636When @FunctionalInterface is Optional
Service declarations
in `module-info.
Lesson 2499The java.util.ServiceLoader Class
Service Provider Interface (SPI)
is a design pattern where an **interface** (or abstract class) is defined by one module, but **implementations** are discovered and loaded dynamically at runtime from other modules.
Lesson 2498The Service Provider Interface (SPI) Pattern
ServiceLoader
is built into the JDK and uses module descriptors (`uses` and `provides.
Lesson 2507Service Loading vs Traditional Dependency Injection
Set thread priorities
Ensure critical tasks get CPU time
Lesson 2866Why Custom Executors Matter: Isolation and Resource Control
Sets
to eliminate duplicates within each partition
Lesson 1585Collecting to Different Data Structures per Partition
Setters
(`setFieldName(value)`) let others *write* a field's value with validation
Lesson 338The Purpose of Getters and SettersLesson 723Prefer private Fields with Controlled Public Methods
Setting flags
(turning bits on) uses the `|` operator:
Lesson 123Practical Uses: Bit Flags and Masking
Shadowing
occurs when a variable in an inner scope has the same name as a variable in an outer scope.
Lesson 637Scope and Shadowing in Local ClassesLesson 2487Package Splitting and exports: Avoiding Conflicts
Shared counters
or configuration data
Lesson 594Static Fields and Methods in Enums
Shared Memory
Multiple threads within the same process can access the same variables, objects, and heap memory.
Lesson 2554Thread: A Lightweight Execution Unit
Shared Memory Space
Threads within a process share the same memory address space.
Lesson 2559Context Switching Costs
Shared state is essential
Subclasses need common fields (instance variables)
Lesson 525Abstract Classes: Is-A with Shared Implementation
Shared utility
Serves both static and default methods
Lesson 522Private Static Methods in Interfaces
Ship it
Users extract and run—no JRE installation needed
Lesson 2551Distributing Custom Runtime Images
Short bucket chains
With good hash distribution and proper load factor, most buckets contain 0-1 elements
Lesson 1112Performance Characteristics: O(1) Average Case
Short-circuiting intermediate operations
Transform the stream and can limit its size
Lesson 1411What Are Short-Circuiting Operations?Lesson 1478Performance Characteristics and Short-Circuiting
Short-circuiting terminal operations
Produce results without necessarily processing all elements
Lesson 1411What Are Short-Circuiting Operations?
Short-lived computations
that complete quickly
Lesson 2781Async Execution Models: Common vs Custom Executors
Short-term caching
If you need to temporarily store objects in memory or on disk within the same application version, serialization works fine.
Lesson 2111When to Use and Avoid Serialization
Short, single-line strings
Use simple concatenation or `formatted()`
Lesson 2243Text Blocks vs String Concatenation
Shutdown initiated
No longer accepting new tasks, but still processing existing ones
Lesson 2774isShutdown() and isTerminated() Status Methods
Silent failures
Your `set()` call may succeed without throwing an exception, yet other parts of the program continue seeing the original value.
Lesson 2357Final Fields: Modification Restrictions and Workarounds
Simple applications
Premature optimization—start with explicit passing
Lesson 2641ThreadLocal Alternatives and When to Avoid It
Simple patterns
with few captures where position is obvious
Lesson 2275Named Groups vs Numbered Groups
Simple return values work
Returning `null`, `-1`, or `Optional` is often clearer than throwing exceptions for normal "not found" scenarios
Lesson 821Best Practices: Avoiding Exception Overuse
Simple, short operations
where the entire method needs exclusive access
Lesson 2660When to Use Synchronized Methods
Simplicity
The relationship isn't strong enough to justify nesting
Lesson 619Static Nested Classes vs Top-Level Classes
Simplified deployment
You distribute one self-contained package—no "Java version mismatch" issues.
Lesson 2544What is jlink and Why Custom Runtime Images MatterLesson 2551Distributing Custom Runtime Images
Simplifies code
No more verbose `finally` blocks with nested try-catch
Lesson 829Why AutoCloseable Matters
Simplifies usage
No need to create an object just to call the method
Lesson 367Common Use Cases for static Methods: Utility Functions
Simplifying APIs
passing implicit context without adding parameters to every method call
Lesson 2633What is ThreadLocal and Why It Exists
Simulating delays or rate-limiting
When testing concurrent behavior or avoiding overwhelming external systems (APIs, databases), you insert deliberate pauses between operations.
Lesson 2590The Purpose of Thread.sleep
Single catch (reassignment allowed)
Lesson 763The Implicit final in Multi-Catch
Single inheritance constraint
A class can only extend one abstract class, even if it's empty.
Lesson 530Marker Interfaces vs Empty Abstract Classes
Single iteration
The stream pipeline executes only once
Lesson 1613Performance Benefits of teeing Over Multiple Passes
Single quotes only
`'A'` is a `char`, but `"A"` (double quotes) is something different you'll learn later.
Lesson 48The char Type: Representing Single Characters
Single static import
brings in exactly one static member:
Lesson 673Single Static Import vs Static Import on Demand
Single thread only
→ Migrate to `HashMap`
Lesson 1158Migrating from Hashtable to Modern Alternatives
Single vs multiple inheritance
A class extends only one abstract class but can implement many interfaces.
Lesson 513Default Methods and Abstract Classes
Single-parameter interfaces
work with one input:
Lesson 1673Understanding Binary Functional Interfaces
Single-threaded context
(99% of cases): Use `StringBuilder`
Lesson 2194When to Use StringBuilder vs StringBuffer
Single-use only
Once you've processed a stream, it's consumed and cannot be reused.
Lesson 1367Streams Are Not Data Structures
Sink gadget
A class that performs the dangerous action (file I/O, reflection, etc.
Lesson 2159Gadget Chains and Object Injection
Size computation
Some collections compute size dynamically
Lesson 1392Collection.stream() vs Arrays.stream() Performance Considerations
SKIP_SIBLINGS
"Done with this floor, go upstairs"
Lesson 2090FileVisitResult: Controlling Traversal Flow
SKIP_SUBTREE
"Don't open that closet, but check other rooms"
Lesson 2090FileVisitResult: Controlling Traversal Flow
Slow with frequent flush
You're forcing too many disk syncs.
Lesson 1958Profiling I/O Performance: Identifying Bottlenecks
Small enough
to avoid wasting memory.
Lesson 1935Default Buffer Size: 8KB Explained
Small files
Overhead of large buffers may outweigh benefits.
Lesson 1952Buffer Size Selection and Throughput
Small to moderate queues
For queues with dozens to a few hundred elements where the performance difference is negligible and the familiar `LinkedList` API is comfortable.
Lesson 1180When to Use LinkedList as a Queue
Small, known vocabularies
such as country codes, currency symbols, or protocol commands
Lesson 2184Common Use Cases and Anti-patterns
Smaller buffers (1KB–4KB)
More frequent disk operations, lower throughput, but lower memory footprint.
Lesson 1952Buffer Size Selection and Throughput
Smaller footprint
Only necessary modules included, not a full JDK
Lesson 2551Distributing Custom Runtime Images
Smaller payloads
Binary formats like Protocol Buffers are often more compact
Lesson 2165Alternatives to Java Serialization
Smaller runtime footprint
Since the JVM discards these annotations, your program uses slightly less memory
Lesson 2436RetentionPolicy.CLASS Explained
Snapshot-like
Elements present when iteration began are guaranteed to be traversed exactly once
Lesson 1307ConcurrentHashMap and Weakly Consistent Iterators
Solaris
Historically had robust priority mapping, but with its own quirks.
Lesson 2629Platform-Dependent Priority Mapping
Sort
scores by value (requires `Comparable`)
Lesson 925Use Case: Combining Comparable and Serializable
sorted streams
, `takeWhile` and `dropWhile` excel at extracting ranges based on business logic:
Lesson 1479Common Use Cases and PatternsLesson 1542findFirst: Deterministic Element Selection
Sorted tree
O(log n) — can eliminate half the remaining entries with each comparison
Lesson 1118Comparable Keys and Tree Ordering
SOURCE annotations
are meant for compile-time tools (like `@Override` or `@SuppressWarnings`)—they guide the compiler but serve no purpose afterward.
Lesson 2379Annotation Retention and Runtime Availability
Space Complexity
**O(1)**—only two pointer variables needed, no matter how large the list
Lesson 1230Reverse Internals: How Swapping Works
Space complexity is O(n)
where n is the number of distinct elements
Lesson 1448Performance Implications of distinct on Large Streams
Space efficiency
Common text uses far less space than fixed-width encodings
Lesson 2000UTF-8: Variable-Length Encoding
Special-value style
The host politely says "Sorry, no availability right now" (returns false/null).
Lesson 1171Exception-Throwing vs Returning-Special-Value Methods
Specialized atomic operations
like `putIfAbsent`
Lesson 1254When to Use Synchronized Wrappers
Speed
Singleton collections are slightly faster for creation and access because there's no array initialization or bounds checking overhead.
Lesson 1258Singleton vs Single-Element List Performance
Spring's Dependency Injection
Spring scans your classes for annotations like `@Autowired`, `@Component`, or `@Service`.
Lesson 2388Common Use Cases: Frameworks and Libraries
Square extends Rectangle
At first glance, this seems logical—a square is mathematically a type of rectangle.
Lesson 436Violating is-a: Common Design Mistakes
Stability
means elements that compare as equal maintain their original relative order after sorting.
Lesson 1336Comparator Stability and Equals Consistency
Stack behavior
(LIFO): `push()` and `pop()` operations
Lesson 984Queue vs Deque: Choosing the Right End-Access Pattern
Stack extends ArrayList
You might think "a stack uses a list internally, so let's extend it!
Lesson 436Violating is-a: Common Design Mistakes
Stack growth
`main` calls `methodA` (frame pushed), which calls `methodB` (frame pushed).
Lesson 749Normal Stack Unwinding
StackOverflowError
The call stack has exceeded its maximum depth, usually from infinite recursion (a method calling itself endlessly without a proper base case).
Lesson 782VirtualMachineError and LinkageError: System-Level Errors
Stale data is possible
The iterator may show old data if the list was modified after iteration began
Lesson 1306CopyOnWriteArrayList: A Fail-Safe Example
Standard exceptions fit perfectly
Use `IllegalArgumentException` for bad parameters rather than inventing `InvalidEmailException`
Lesson 821Best Practices: Avoiding Exception Overuse
Starting character
Must begin with a letter
Lesson 2289Username and Identifier Patterns
Starting new projects
where you control all dependencies and can define clean module boundaries from day one
Lesson 2524Migration Strategy: When to Use Module Path vs Classpath
Starvation
occurs when a thread is perpetually denied access to shared resources it needs to make progress, even though it isn't technically blocked or stuck in a loop.
Lesson 2705What Is Starvation?
State (fields)
Abstract classes can have instance variables with any access modifier.
Lesson 513Default Methods and Abstract Classes
State required
You need fields or instance variables
Lesson 649When to Prefer Lambdas Over Anonymous Classes
stateful operation
it must maintain state about *all* elements before producing output.
Lesson 1452The Stateful Nature of sortedLesson 1484Sorting Before limit
Stateless utility functions
(pure functions) make testing predictable because:
Lesson 391Testing Utility Classes
Statement block level
Not directly supported, so use the smallest enclosing scope
Lesson 2413@SuppressWarnings: Scope and Best Practices
static binding
(compile-time binding): Java decides which `static` method to call based on the *reference type* at compile time, not the actual object.
Lesson 422static Methods Cannot Be OverriddenLesson 463Static vs Dynamic Binding
Static field
1 coffee machine shared by all
Lesson 361static Fields and Memory: Single Copy
Static import
Brings *static members* into scope so you don't need the class name
Lesson 376Understanding static Import SyntaxLesson 377Importing Static Methods and Fields
Static import on demand
uses the wildcard `*` to import *all* static members from a class:
Lesson 673Single Static Import vs Static Import on Demand
Static imports
let you skip the class name and use static fields and methods directly, as if they were declared in your own class:
Lesson 376Understanding static Import SyntaxLesson 672Static Import: Importing Static Members
static nested class
is a class declared inside another class with the `static` modifier.
Lesson 614What Are Static Nested Classes?Lesson 615Declaring and Instantiating Static Nested Classes
Static scope
No access to instance-specific data
Lesson 522Private Static Methods in Interfaces
static synchronized methods
(not yet covered), the lock belongs to the `Class` object itself.
Lesson 2653The Implicit Lock (Monitor) of an ObjectLesson 2657synchronized static Methods
Statistics
Find the most or least common elements
Lesson 1264Collections.frequency: Counting Element Occurrences
Stop running tasks
If `mayInterruptIfRunning` is `true` **and** the task is already executing, the thread running it receives an interrupt signal.
Lesson 2744cancel(): Attempting to Stop Running Tasks
Stops accepting new tasks
(just like `shutdown()`)
Lesson 2716Forceful Shutdown: The shutdownNow Method
Store in that bucket
The key-value pair is placed in the chosen bucket.
Lesson 554How HashMap Uses hashCode for Bucket Selection
Store the element
at index `size` in the backing array
Lesson 1012The add Operation: Common Case Without Resize
Store timestamps
in databases where you care about the exact offset but not the time zone name
Lesson 1867Introduction to OffsetDateTime
Stores duplicates
The second "equal" object goes into a different bucket, so `HashSet` doesn't detect it's a duplicate during `add()`
Lesson 1086Breaking HashSet with Bad hashCode
Storing future events
When you need to preserve the intended local time across potential time zone rule changes.
Lesson 1856Best Practices: When to Use ZonedDateTime
Storing Timestamps in Databases
Lesson 1875Use Cases for OffsetDateTime
Stream API operations
(sorting, filtering chains, collectors)
Lesson 2080DirectoryStream vs Files.list: When to Use Which
Stream position advances
After skipping, the next `read()` starts from the new position
Lesson 1910The skip(long) Method for Skipping Bytes
Stream processing
You're processing data as a *stream* rather than a *collection*
Lesson 2014Processing Large Files with readLine
Stream terminates
The stream is consumed and cannot be reused
Lesson 1488Understanding forEach as a Terminal Operation
Stream's `map()`
transforms each element in a pipeline:
Lesson 2805thenApply vs map in Stream API
Strict is-a relationship
A clear inheritance hierarchy exists (e.
Lesson 532Decision Criteria: A Practical Checklist
String Intern Pool
(also called the "string pool" or "string constant pool") is a special memory area maintained by the JVM that stores a single copy of each unique string literal.
Lesson 2176What is the String Intern Pool?Lesson 2177String Literal Interning by Default
String paths
for simple, straightforward cases.
Lesson 1969Creating FileReader Instances with File Paths
StringBuffer
solve this by providing a **mutable character buffer** that grows as needed.
Lesson 2185Why StringBuilder and StringBuffer Exist
Strings and primitives
Call the method directly, get the value
Lesson 2384Extracting Annotation Element Values
Strings are immutable
every concatenation creates a new String object.
Lesson 2185Why StringBuilder and StringBuffer Exist
Strip version suffixes
– Numbers and trailing separators at the end are removed: `commons-lang3-3.
Lesson 2537Automatic Module Naming from JAR Filename
Strong logical relationship
The nested class exists primarily to support the outer class and rarely makes sense independently (like `Map.
Lesson 619Static Nested Classes vs Top-Level Classes
Structural changes
You didn't declare `serialVersionUID` at all, and Java's automatic computation produced different values due to class modifications
Lesson 2125InvalidClassException: Version Mismatch Errors
Subclassing is required
– other classes must extend it to provide specific implementations
Lesson 478The abstract Keyword for Classes
Submit phase
Loop through your tasks, calling `submit()` for each and storing the returned `Future` in a collection
Lesson 2748Practical Pattern: Submitting Multiple Tasks and Collecting Results
Subtraction (-)
Subtracts the right value from the left.
Lesson 86The Five Basic Arithmetic Operators: +, -, *, /, %
Summing collectors
(`summingInt`, `summingLong`, `summingDouble`) return **0** (or 0L, 0.
Lesson 1594Handling Empty Streams with Summing and Averaging Collectors
superclass
(or parent class), and the specialized class is called the **subclass** (or child class).
Lesson 393What Is Inheritance? The extends KeywordLesson 400The Subclass Constructor and Implicit super()
Superclass constructor executes first
(triggered by `super()`)
Lesson 407Constructor Chaining: The Initialization Sequence
Surprise
The indentation *looks* like both lines belong to the `if`, but Java only binds the first `println` to the condition.
Lesson 137Block Statements vs Single Statements
Switch
from user space to kernel space (a context switch)
Lesson 1953System Call Overhead and User vs Kernel Space
Symbolic link support
First-class support for links and advanced file attributes
Lesson 2025Introduction to NIO.2 and the Path Interface
Symmetry means exact correspondence
Every piece of data you write in `writeObject` must be read back in `readObject` in the **same order** and using the **same data type**.
Lesson 2145Maintaining Read/Write Symmetry
synchronized
, meaning every method automatically locks the collection to ensure thread safety when multiple threads access it.
Lesson 977Legacy Collection Classes: Vector and HashtableLesson 1153Hashtable vs HashMap: Key DifferencesLesson 2187StringBuffer: Thread-Safe String Building
Synchronized blocks
let you lock only part of a method and explicitly specify which object's lock to use.
Lesson 2661Synchronized Blocks vs Synchronized Methods
Synchronized wrappers
Simple threading needs, occasional concurrent access, wrapping legacy collections
Lesson 986Synchronized Collections vs Concurrent CollectionsLesson 1252Synchronized Wrappers vs Concurrent Collections
Synchronous execution
The transformation happens in the same thread that completes the prior stage
Lesson 2797What thenApply Does: Synchronous Transformation
System load
Heavy CPU usage means more threads competing for execution time
Lesson 2596Sleep Precision and Guarantees
System resources
Reinitialize connections, file handles, or other non-serializable resources
Lesson 2138Restoring transient Fields on Deserialization
System-wide failure
Not just your app—other programs may fail to open files
Lesson 1942Why Closing Streams Matters: Resource Leaks Explained

T

T2
Thread B acquires `lock2` (different lock, succeeds)
Lesson 2693Visualizing the Circular Wait
T3
Thread A tries to acquire `lock2` → **BLOCKS** (B holds it)
Lesson 2693Visualizing the Circular Wait
T4
Thread B tries to acquire `lock1` → **BLOCKS** (A holds it)
Lesson 2693Visualizing the Circular Wait
Tail-recursive version
(factorial with accumulator):
Lesson 231Tail Recursion: Optimizable Recursive Calls
target functional interface
(the interface your lambda is being assigned to or passed as) and extracts the generic types from its declaration.
Lesson 1714Type Inference with GenericsLesson 1739Method Reference Type Inference
Target node's `prev`
→ now points back to the new node
Lesson 1024Inserting Elements in the Middle
Target object
The instance whose field you want to modify (or `null` for static fields)
Lesson 2353Field.set: Writing Field Values
Task Scheduling
When you have jobs that arrive over time and must be executed in the order they arrived, a queue is your solution.
Lesson 1174Queue Use Cases: Task Scheduling and BufferingLesson 1183What Is a PriorityQueue?
Team boundaries
Allow specific modules maintained by your team to collaborate while hiding implementation details from external modules.
Lesson 2484Multiple Qualified exports for Fine-Grained Control
Team Conventions
In large codebases, consistency matters.
Lesson 1717Type Inference Benefits and Readability
Team expertise is limited
and training time isn't available
Lesson 2524Migration Strategy: When to Use Module Path vs Classpath
Template Method
pattern: `LinkedHashMap` defines the insertion algorithm, but lets you customize one specific decision point (whether to remove old entries) by overriding a hook method.
Lesson 1148The removeEldestEntry Hook Method
Template Method Pattern
uses an abstract class to define the overall structure of an algorithm, while letting subclasses override specific steps.
Lesson 529The Template Method Pattern with Abstract ClassesLesson 713Protected Access in Inheritance: The Protected Modifier
Template methods
When your method calls other overridable methods in a specific sequence that shouldn't be altered
Lesson 424The final Keyword on Methods
Temporary state
session IDs, timestamps that become stale
Lesson 2132Marking Fields as transient
TERMINATE
"Exit the building immediately"
Lesson 2090FileVisitResult: Controlling Traversal Flow
Test boundaries
Verify conversions preserve values correctly, especially around DST transitions
Lesson 1902Interoperating with Legacy APIs
Test incrementally
Each automatic → explicit conversion should be validated independently
Lesson 2543Migration Strategy: From Automatic to Explicit Modules
Test thoroughly
to confirm the module works both independently and when consumed
Lesson 2526The Bottom-Up Migration Strategy
Test with HashSet operations
The simplest approach is to actually use your objects in a `HashSet` and verify the expected behavior:
Lesson 1093Testing Your equals and hashCode Implementations
Test your method calls
to ensure they compile without ambiguity
Lesson 215Common Overloading Pitfalls and Ambiguity
Testable
Easy to verify with different inputs
Lesson 387Pure Functions and Statelessness in Utility Classes
Testing vs Production
Consider opening packages only to testing frameworks using qualified `opens`, keeping production code more locked down.
Lesson 2497Security and Design Trade-offs with opens
Tests become critical
Runtime is the only place these breaks surface
Lesson 2396Maintaining Code with Reflection
Text alignment
Preparing multi-line strings for display in columns
Lesson 2221The indent Method: Adding Leading Whitespace
Text blocks
are a special syntax for multi-line string literals, introduced in Java 15.
Lesson 2234What Are Text Blocks?Lesson 2243Text Blocks vs String Concatenation
Text data
consists of bytes that represent human-readable characters encoded using a character set (like UTF-8 or ASCII).
Lesson 1930Binary Data vs Text DataLesson 1967Reader vs InputStream: When to Use Which
Text transformation
Prefix each line with line numbers or bullets
Lesson 2224Combining lines with Stream Operations
Text-oriented
Designed specifically for reading textual data
Lesson 1959The Reader Hierarchy: Character-Based Input
Then
add your element to the freshly expanded array
Lesson 1013Triggering a Resize: When Capacity Is Exhausted
They export everything
All packages become public API, even internal implementation details
Lesson 2543Migration Strategy: From Automatic to Explicit Modules
They never throw ConcurrentModificationException
, even if the map changes during iteration
Lesson 1164Iterators and Weakly Consistent Views
They reflect a snapshot
of the map at (or near) the time the iterator was created
Lesson 1164Iterators and Weakly Consistent Views
They require everything
They implicitly depend on all other modules, creating overly broad dependency graphs
Lesson 2543Migration Strategy: From Automatic to Explicit Modules
Third-party libraries aren't modular
and heavily use reflection without proper `opens` declarations
Lesson 2524Migration Strategy: When to Use Module Path vs Classpath
This class is incomplete
– it represents a general concept that shouldn't exist on its own
Lesson 478The abstract Keyword for Classes
This is incorrect
A stream does not hold or store data.
Lesson 1367Streams Are Not Data Structures
Thread configuration
Control thread counts, priorities, or naming
Lesson 2864Passing Custom Executors to Async Methods
Thread dumps
Show circular lock dependencies
Lesson 2703Detecting Livelock vs Deadlock
Thread objects
– cannot be meaningfully restored
Lesson 2136Use Case: Non-Serializable References
Thread pool compatibility
`Runnable` works seamlessly with executor frameworks you'll learn later
Lesson 2572Creating a Thread with Runnable
Thread pool environments
Risk of data leakage between requests
Lesson 2641ThreadLocal Alternatives and When to Avoid It
Thread priority imbalance
High-priority threads monopolize CPU time (you learned about priority risks in lesson 2631)
Lesson 2705What Is Starvation?
Thread reuse
Avoids the overhead of creating and destroying threads
Lesson 2720newFixedThreadPool: Creating a Fixed-Size Thread Pool
Thread safety without synchronization
immutable objects are inherently safe to share
Lesson 727Immutability and final: Defensive Access Control
Thread starvation
happens when a thread never gets CPU time because other threads with equal or higher priority constantly monopolize the processor.
Lesson 2631Priority Inversion and Starvation Risks
Thread state
`BLOCKED` or `WAITING`
Lesson 2703Detecting Livelock vs Deadlock
Thread-confined objects
avoiding synchronization overhead by giving each thread its own instance
Lesson 2633What is ThreadLocal and Why It Exists
Threads terminate
only after all work is done do the pool threads exit
Lesson 2715Graceful Shutdown: The shutdown Method
Three
`userId` fields exist (one per object)
Lesson 361static Fields and Memory: Single Copy
threshold
is the exact number of elements that, when reached, forces HashSet to rehash.
Lesson 1060Threshold: When Rehashing TriggersLesson 1125When Rehashing Occurs: The Threshold Calculation
Throws `FileAlreadyExistsException`
if the target already exists (it won't overwrite by default)
Lesson 2055Files.copy: Basic File Copying
Throws `IOException`
for other I/O problems (permissions, disk space, etc.
Lesson 2055Files.copy: Basic File Copying
Throws `NoSuchFileException`
if the source file doesn't exist
Lesson 2055Files.copy: Basic File Copying
Throws if all fail
If every task throws an exception, `invokeAny` throws `ExecutionException` wrapping the last exception encountered.
Lesson 2763invokeAny: Racing Multiple Callables
Tight coupling
where the inner class is meaningless without its outer context
Lesson 630Inner Classes and Encapsulation
Tight loops
If you're calling a reflected method millions of times per second in performance-critical code (data processing, game loops, real-time systems), the overhead becomes noticeable.
Lesson 2350Performance Costs of Reflective Invocation
Tighter coupling
Abstract classes suggest implementation sharing, not just type tagging.
Lesson 530Marker Interfaces vs Empty Abstract Classes
Time Complexity
O(n/2), which simplifies to **O(n)**—you visit roughly half the elements, but each swap touches two positions
Lesson 1230Reverse Internals: How Swapping Works
Time without context
Use `LocalDateTime` for internal calculations where time zones don't matter.
Lesson 1856Best Practices: When to Use ZonedDateTime
Time Zone Nightmares
`Date` didn't truly represent a "date"—it was just milliseconds since the Unix epoch (January 1, 1970 UTC).
Lesson 1895Problems with java.util.Date and java.util.Calendar
Timeout issues
The database took too long to respond
Lesson 806SQLException: Database Access Errors
Timeout variant
`invokeAll(tasks, timeout, unit)` cancels incomplete tasks after the timeout
Lesson 2758invokeAll: Executing Multiple Callables
Timeouts
Use operations with built-in timeout mechanisms when available, so blocking doesn't last forever
Lesson 2607Interruption and Non-Interruptible Blocking
Together
, they guarantee the object's state never changes
Lesson 727Immutability and final: Defensive Access Control
Too large
(like 2x): You waste significant memory with unused capacity
Lesson 1007The Growth Strategy: 1.5x Expansion
Top-level class
Pollutes namespace for single-use logic
Lesson 639Practical Use Cases for Local Classes
Track state across iterations
Maintain counters or accumulators that survive beyond one loop cycle
Lesson 191Declaring Variables Before Control Structures
Traditional DI frameworks
are runtime-heavy solutions that scan classes, read annotations, manage object lifecycles, and inject dependencies automatically.
Lesson 2507Service Loading vs Traditional Dependency Injection
Traditional way (anonymous class)
Lesson 2564Lambda Expressions with Runnable
Transform
values without side effects
Lesson 2805thenApply vs map in Stream API
Transform before comparing
Sort strings case-insensitively, trim whitespace, or apply calculations
Lesson 1339Comparator.comparing() with Lambda Expressions
Transform results
without blocking threads
Lesson 2777What is CompletableFuture and Why Use It?
transforms
your clean for-each syntax into traditional iterator code before generating bytecode.
Lesson 1292How the Enhanced For Loop Works InternallyLesson 1436What flatMap Does: Flattening Nested Structures
Transient fields
(marked with `transient` keyword) → skipped
Lesson 2106Automatic Serialization of Instance Fields
Tree bin
At most ~7 comparisons (log₂ 100 ≈ 6.
Lesson 1115Tree Bins: The Java 8 Optimization
TreeMap/TreeSet
Adding or removing entries
Lesson 1304Fail-Fast in HashMap and Other Collections
True Immutability
Java 9+ factories create truly immutable collections, not just unmodifiable views
Lesson 1263Comparing Factory Methods with Java 9+ Collection Factories
TRUNCATE_EXISTING
If the file exists, truncate it to zero length (erasing all previous content) before writing.
Lesson 2051OpenOption: Controlling Write Behavior
Two separate methods
(one for sorting, one for saving)
Lesson 925Use Case: Combining Comparable and Serializable
two-dimensional array
, which you can visualize as a grid or table with rows and columns.
Lesson 253What Are Multidimensional Arrays?Lesson 2383Reading Annotations from Constructors and Parameters
Type casting
You must cast each object back to its original type
Lesson 2115Serializing Multiple Objects in Sequence
Type checking
Verifying what something is at runtime
Lesson 2320What is the Class Object?
Type checking and validation
happen at runtime instead of compile-time
Lesson 2395Performance Overhead of Reflection
Type checking at runtime
Determine if two objects are instances of the exact same class
Lesson 571The getClass Method: Runtime Type InformationLesson 2350Performance Costs of Reflective Invocation
Type of parameters
(one takes `int`, another takes `double`)
Lesson 207Method Overloading Fundamentals
Type pattern matching
extends `switch` to test *what type* an object is, similar to how you'd use multiple `instanceof` checks.
Lesson 154Pattern Matching in switch (Preview/Java 17+)
Type Safety Preserved
The compiler still enforces all type checks using the target type context.
Lesson 1717Type Inference Benefits and Readability
Type Specialization
The JIT thrives on knowing exact types to generate optimized machine code.
Lesson 2402JIT Compilation Limits with Reflection
Type-safe merging
You can combine different result types (Integer + String → String)
Lesson 2825Understanding thenCombine: Combining Independent Futures
Type-safe return
The compiler knows the return type matches `T`
Lesson 898Type Tokens and Reification Workarounds
Typo prevention
Catches misspellings like `tostring()` instead of `toString()`
Lesson 2414Built-In Annotations: When and Why to Use Each
Typos in method names
(`tostring()` instead of `toString()`)
Lesson 423Best Practices: Always Use @Override

U

Unbounded
`LinkedList`, `PriorityQueue`—grow until memory runs out
Lesson 1172Queue Capacity Restrictions and Bounded Queues
Unbuffered copy
(1MB file, byte-by-byte):
Lesson 1939Performance Gains: Measuring Buffer Impact
Unbuffered I/O
is like making a separate trip to the store for each individual item—milk on Monday, bread on Tuesday, eggs on Wednesday.
Lesson 1932The Problem with Unbuffered I/O: System Call Overhead
Uncaught exception handlers
specific to your pool's tasks
Lesson 2728Thread Naming and Daemon Status in Factory Methods
Underflow
happens when a negative value is too small (too negative).
Lesson 85Casting Pitfalls: Overflow, Underflow, and Best Practices
Unfair lock acquisition
Some threads repeatedly grab a lock before a waiting thread gets its turn
Lesson 2705What Is Starvation?
Unicode values
Behind the scenes, each character is stored as a number from 0 to 65,535.
Lesson 48The char Type: Representing Single Characters
Union
is straightforward—simply list multiple ranges or characters inside one set of brackets, and any character matching *any* of those ranges will match.
Lesson 2299Union and Intersection in Character Classes
Unique keys
Each key appears only once; duplicate keys replace the old value
Lesson 997HashMap: Key-Value Pairs with Hashing
Unit of operation
`Reader` works with `char` instead of `byte`
Lesson 1959The Reader Hierarchy: Character-Based Input
Unit testing
ThreadLocal makes mocking and isolation difficult
Lesson 2641ThreadLocal Alternatives and When to Avoid It
Universal familiarity
Nearly every Java developer uses `ArrayList` regularly
Lesson 900ArrayList<E> as the Canonical Generic Collection
Unix/Linux/Mac (modern)
`\n` (line feed)
Lesson 2008Line Terminator Handling Across Platforms
Unmappable characters
You're writing a character that doesn't exist in your chosen encoding (e.
Lesson 2006Encoding Errors and Replacement Characters
Unmodifiable
A view that prevents *you* from making changes, but the underlying collection can still change
Lesson 1238What Are Unmodifiable Collections?
Unmodifiable collections
Collections wrapped to be read-only (you'll learn wrapper methods later)
Lesson 802UnsupportedOperationException in CollectionsLesson 1281Why remove() Is Optional and May Throw UnsupportedOperationException
Unmodifiable views
wrap the original collection and block modification methods.
Lesson 1245Defensive Copying vs Unmodifiable Views
UnsatisfiedLinkError
Native method dependency cannot be found.
Lesson 782VirtualMachineError and LinkageError: System-Level Errors
Unstable naming
Without an `Automatic-Module-Name` manifest entry, module names derive from filenames, which can change
Lesson 2543Migration Strategy: From Automatic to Explicit Modules
Unwind the stack
– The JVM searches backward through method calls looking for a matching `catch` block, executing any `finally` blocks along the way
Lesson 755Performance Impact of Unwinding
Upcasting
is when you treat a subclass instance as if it were an instance of its superclass.
Lesson 439What is Upcasting?
Update a single index
(the `head` or `tail` pointer)
Lesson 1208Performance Characteristics: O(1) Operations
Update the head reference
to point to the new node instead of the old first node
Lesson 1022Adding Elements to the BeginningLesson 1025Removing the First Element
Use `Class.class`
for static data protection
Lesson 2663Choosing the Lock Object
Use `exports`
for your public API—classes you want other modules to depend on and use directly
Lesson 2491opens vs exports: Key Differences
Use `flatMap`
when each input element transforms into **zero, one, or multiple output elements** that need to be "unpacked" into a single flat stream:
Lesson 1439flatMap vs map: When to Use Each
Use `HashMap`
for single-threaded code or when you can control synchronization externally
Lesson 1153Hashtable vs HashMap: Key Differences
Use `ifPresent`
when you want to perform a side effect (logging, updating external state) with the value as-is
Lesson 1799Common Mistakes: Using ifPresent When map Is Better
Use `map`
when each input element transforms into **exactly one output element**.
Lesson 1439flatMap vs map: When to Use EachLesson 1799Common Mistakes: Using ifPresent When map Is Better
Use `opens`
for frameworks that need reflection (like Spring, Hibernate, or JUnit) but aren't part of your intended API
Lesson 2491opens vs exports: Key Differences
Use `Optional.of(value)`
when you **guarantee** the value is **never null**.
Lesson 1766When to Use of() vs ofNullable()
Use `Optional.ofNullable(value)`
when the value **might be null**, and you want to handle that possibility gracefully.
Lesson 1766When to Use of() vs ofNullable()
Use `orElse` for
Simple constants or pre-computed values
Lesson 1824Anti-Pattern: Overusing orElse with Expensive Operations
Use `orElseGet` for
Method calls, object creation, or any computation
Lesson 1824Anti-Pattern: Overusing orElse with Expensive Operations
Use `ServiceLoader`
to discover and load implementations dynamically — no direct constructor calls
Lesson 2498The Service Provider Interface (SPI) Pattern
Use `shutdown()`
when task completion matters (database updates, file processing, network requests)
Lesson 2768Understanding Graceful vs Immediate Shutdown
Use `shutdownNow()`
when speed matters more than completion (emergency shutdown, application crash recovery)
Lesson 2768Understanding Graceful vs Immediate Shutdown
Use `StringBuffer` only when
Multiple threads will access and modify the *same* instance concurrently.
Lesson 2194When to Use StringBuilder vs StringBuffer
Use `substring()`
to extract the username and domain separately
Lesson 2205Combining substring, indexOf, and replace for String Parsing
Use `thenAccept`
when you need to *consume* the result of the previous stage
Lesson 2813Choosing Between thenAccept and thenRun
Use `thenRun`
when you just need to run an action *after completion*, regardless of the result
Lesson 2813Choosing Between thenAccept and thenRun
Use `this`
when simplicity matters and you control all synchronization
Lesson 2663Choosing the Lock Object
Use a dedicated lock
when you need isolation, multiple locks for different purposes, or when building libraries
Lesson 2663Choosing the Lock Object
Use case
Caches where entries can be discarded when memory is tight.
Lesson 302Weak, Soft, and Phantom References
Use descriptive names
that reflect the relationship: `Builder`, `Config`, `Validator`
Lesson 621Common Use Cases and Best Practices
Use lazy operations
Streams process lazily, so terminating early (with `findFirst()` or `limit()`) stops traversal
Lesson 2093Performance and Resource Management in Walks
Use nouns
classes represent things (`Car`, `Student`, `Invoice`)
Lesson 305Declaring a Class: Syntax and Naming Conventions
Use parentheses
when you're unsure or want to make your intent crystal clear:
Lesson 112Chaining Comparisons and Operator Precedence
Use PascalCase
capitalize the first letter of each word (`BankAccount`, `User`, `ShoppingCart`)
Lesson 305Declaring a Class: Syntax and Naming Conventions
Use specific module names
rather than `ALL-UNNAMED` when possible
Lesson 2530Using --add-exports and --add-opens as Temporary Workarounds
Use static imports sparingly
, primarily for widely-recognized constants (`PI`, `E`) or frequently-used utility methods (`max`, `min`)
Lesson 675Static Import Anti-Patterns and Best Practices
Use values after branching
Access data determined by an `if-else` after the entire conditional completes
Lesson 191Declaring Variables Before Control Structures
Use very rarely
you're essentially putting tape over your check-engine light.
Lesson 2412@SuppressWarnings: Common Warning Types
Use when
Order matters and duplicates are allowed.
Lesson 979List vs Set vs Map: The Fundamental Decision
Use wrapper methods
Encapsulate conversions in dedicated utility methods
Lesson 1902Interoperating with Legacy APIs
User-facing applications
Where responsiveness matters more than completion
Lesson 2742get() with Timeout: Avoiding Indefinite Blocking
User-facing timestamps matter
When displaying times to users in different locations.
Lesson 1856Best Practices: When to Use ZonedDateTime
User/session identifiers
Who was affected
Lesson 773Logging and Rethrowing: Best Practices
Username requirements
Confirming input meets length and character rules
Lesson 2256Using matches() for Full String Validation
Uses common terminology
Stick to terms your team and industry understand, avoiding abbreviations that aren't obvious
Lesson 683Best Practices: Meaningful Package Names
Using `.class` literal
`Class<String> c = String.
Lesson 382The Class Object: Representing Types at Runtime
UTF-16
Uses 2 or 4 bytes per character (Java's internal char representation)
Lesson 1997What Is Character Encoding?Lesson 2001UTF-16 and UTF-32
UTF-32
Rare in practice.
Lesson 2001UTF-16 and UTF-32
UTF-8
Variable-length encoding supporting all Unicode characters (1-4 bytes per character)—the modern standard
Lesson 1997What Is Character Encoding?Lesson 2047Character Encoding with Charset Parameters
utility class
that provides static methods specifically designed to make array manipulation easier.
Lesson 263The Arrays Class and Its PurposeLesson 385What Is a Utility Class?
Utility classes
that only contain static methods (like `Math` or `Collections`)
Lesson 870Generic Static Methods: Utility Method Patterns
Utility methods
that operate on enum constants
Lesson 594Static Fields and Methods in Enums

V

Validation Frameworks
Libraries scan for annotations like `@NotNull`, `@Min`, or `@Email` on fields, then reflectively read each field's value and apply the corresponding constraint.
Lesson 2387Practical Use Cases: Frameworks and Custom Processing
Value -1
A special sentinel indicating end-of-stream
Lesson 1905The read() Method: Reading a Single Byte
Value propagation
For non-`void` methods, it sends a value back to whoever called the method
Lesson 196The return Statement: Early Exit and Value Propagation
Value-returning methods
perform an action *and* give you a result (like asking someone to "calculate the total and tell me the answer")
Lesson 195Return Types: void vs Value-Returning Methods
Values 0-255
The actual byte value, returned as an unsigned integer
Lesson 1905The read() Method: Reading a Single Byte
Varargs parameter
Accepts any number of `CompletableFuture` instances
Lesson 2854CompletableFuture.allOf: Waiting for All TasksLesson 2855Using allOf with Varargs
Variable declarations
What type is being assigned?
Lesson 1727What Is Target Typing?
Variable level
Suppresses warnings only for that variable's declaration
Lesson 2413@SuppressWarnings: Scope and Best Practices
Variable name
A reference to the exception object, so you can access its details
Lesson 730The catch Block: Handling Specific Exception Types
Vector
Every method is `synchronized`, meaning only one thread can access the method at a time.
Lesson 1031Vector vs ArrayList: Key Differences
Verbose
Simple resource cleanup requires 7+ lines of boilerplate
Lesson 850The Classic finally Block Pattern
Verbose and repetitive
The cast is redundant—you already proved the type with `instanceof`
Lesson 452The Boilerplate Problem: Test-Cast-Use Pattern
Verify
The installer handles most setup automatically
Lesson 4Installing the JDK on Your Operating System
Verify internal state
Check that a private counter incremented correctly
Lesson 2390Testing: Accessing Private Members
Version control
Your app always runs on the exact Java version you tested
Lesson 2551Distributing Custom Runtime Images
Version Information
Tracks implementation and specification versions:
Lesson 686The JAR Manifest File
Version management headaches
Maintaining serialization compatibility across versions requires `serialVersionUID` management and careful planning.
Lesson 2111When to Use and Avoid Serialization
Versioning conflicts
Two libraries shipping different versions of `org.
Lesson 2487Package Splitting and exports: Avoiding Conflicts
Visa
, you need a pattern that matches a `4` followed by 12 or 15 more digits:
Lesson 2288Credit Card Number Patterns
void
when your method's purpose is to cause a *side effect* (printing, modifying variables, etc.
Lesson 195Return Types: void vs Value-Returning MethodsLesson 2322Using .class Literal Syntax

W

Wait for both
The combined future completes only when both inputs complete
Lesson 2825Understanding thenCombine: Combining Independent Futures
WAITING
– The thread is indefinitely waiting for another thread to perform a specific action (like notifying it).
Lesson 2580Thread States Overview: The Five-State ModelLesson 2585WAITING State: Indefinite WaitLesson 2610The join Method: Basic Syntax and Purpose
Warm-up runs
to let the JVM optimize both approaches before measuring
Lesson 2398Method Invocation Overhead: invoke vs Direct Calls
Weak encapsulation
Even with `private` and package-private access, internal implementation classes could be accessed if someone knew the fully-qualified name.
Lesson 2461Introduction to JPMS and the Module System
Weaker consistency
The iterator may show stale data
Lesson 1305What Is Fail-Safe Behavior?
Web frameworks
discovering controllers
Lesson 2392Plugin Architectures and Extensibility
What actually happened
You assigned 5 to `x`, overwriting its original value
Lesson 113Common Pitfalls: Assignment vs Equality
What happens
This code tries to assign `18` to `age`, not compare them.
Lesson 141Common Pitfalls: Assignment vs Comparison
What it returns
The number of bytes actually read, or -1 if the end of stream is reached.
Lesson 1906The read(byte[]) and read(byte[], int, int) Methods
What Java sees
`x & (MASK == VALUE)` ← compilation error
Lesson 125Common Pitfalls: Precedence and Sign Extension
What packages you export
(what the outside world can access)
Lesson 2462The module-info.java File: Location and Purpose
What they encapsulate
(implementation details hidden even from reflection)
Lesson 2461Introduction to JPMS and the Module System
What they export
(which packages are public API)
Lesson 2461Introduction to JPMS and the Module System
What they require
(dependencies on other modules)
Lesson 2461Introduction to JPMS and the Module System
What to run
The `Runnable` task containing your business logic
Lesson 2710The Executor Interface: Decoupling Task Submission from Execution
What you CANNOT do
You cannot make the thread execute its task.
Lesson 2581NEW State: Thread Creation
What you intended
Check if `x` equals 5
Lesson 113Common Pitfalls: Assignment vs Equality
When Optional is empty
Both perform identically (computation runs either way)
Lesson 1789Performance Comparison: orElse vs orElseGet
When protected is acceptable
Template Method pattern scenarios where you explicitly design base classes for extension with well-documented extension points.
Lesson 725Avoiding protected: When Inheritance Leaks Implementation
When type inference fails
Occasionally, the compiler cannot infer types, especially with overloaded methods or complex generics.
Lesson 1706Parameter Type Declaration: Explicit Types
When unsure
Start with `StringBuilder`—premature thread-safety often causes unnecessary performance loss
Lesson 2194When to Use StringBuilder vs StringBuffer
Whitelist
specific classes (only allow these)
Lesson 2162ValidateObjectInputStream and Input Filtering
Why chain constructors
It eliminates duplication.
Lesson 323Constructor Chaining: Building Complex Initialization
Why does this matter
Immutable collections are inherently thread-safe, making them perfect for concurrent environments or when you want to guarantee data won't change after collection.
Lesson 1557toUnmodifiableSet() and toUnmodifiableMap()
Why it fails
The compiler doesn't know if `numbers` holds `Integer`, `Double`, or some other `Number` subtype.
Lesson 938Common Wildcard Mistakes and Compiler Errors
Why reading is problematic
The compiler doesn't know the *actual* type stored in the collection.
Lesson 943Contravariance with '? super T': Write-Only Semantics
Why this restriction
Java's regex engine scans text left-to-right and needs to step backward a precise, predictable number of characters when evaluating lookbehinds.
Lesson 2310Lookbehind Limitations in Java
Widen only when needed
Need access from a subclass?
Lesson 337The Principle of Least Privilege
Widening access modifiers
or adding methods
Lesson 2164Versioning Problems and Class Evolution
With capturing
`(http|https)://(.
Lesson 2269Non-Capturing Groups: (?:...)
With head reference only
Adding to the front is O(1), but adding to the back requires O(n) traversal.
Lesson 1021Head and Tail References
With identity and accumulator
`reducing(T identity, BinaryOperator<T> op)`
Lesson 1597The reducing Collector: General-Purpose Reduction
With intermediate operations
, `limit()` and `takeWhile()` restrict how many elements flow through the entire pipeline, so every downstream operation (`map()`, `filter()`, etc.
Lesson 1416Performance Benefits of Short-Circuiting
With mapper and accumulator
`reducing(T identity, Function<U,T> mapper, BinaryOperator<T> op)`
Lesson 1597The reducing Collector: General-Purpose Reduction
With ordered streams
(like from a `List`):
Lesson 1476Ordered vs Unordered Streams
With red-black trees
8 collisions = at most 3 comparisons (O(log 8) = 3)
Lesson 1117Red-Black Trees: The Data Structure Behind Tree Bins
With reentrancy
The thread already holds the lock, so it proceeds into `inner()` without blocking.
Lesson 2671What Is Reentrancy?
With the annotation
, the compiler catches this immediately:
Lesson 2416Compiler Verification and Error Prevention
With unordered streams
(like from a `HashSet`):
Lesson 1476Ordered vs Unordered Streams
Within the same module
Works as before—you can access private members
Lesson 2496setAccessible and opens: How They Interact
without any access modifier
, Java applies **package-private** access by default.
Lesson 328Package-Private (Default) AccessLesson 700Package-Private Members: Default Package Visibility
Without finisher
(identity finisher): `Collector.
Lesson 1621Collector.of: Building Custom Collectors
Without identity
(returns `Optional`): `reducing(BinaryOperator<T> op)`
Lesson 1597The reducing Collector: General-Purpose Reduction
Without reentrancy
The thread would wait *for itself* to release the lock—instant deadlock.
Lesson 2671What Is Reentrancy?
Without trees
8 collisions = up to 8 comparisons (O(n))
Lesson 1117Red-Black Trees: The Data Structure Behind Tree Bins
Working with dates only
Use `LocalDate` for birthdays, holidays, or date ranges.
Lesson 1856Best Practices: When to Use ZonedDateTime
Working with object streams
(`Stream<T>`) — you're already dealing with objects
Lesson 1698When to Use Primitive Specializations vs Generics
Working with primitive streams
(`IntStream`, `LongStream`, `DoubleStream`) — the API is designed for these types
Lesson 1698When to Use Primitive Specializations vs Generics
Workload isolation
Separate CPU-intensive transformations from I/O operations by using distinct pools.
Lesson 2803Using thenApplyAsync with Custom Executor
Works on a snapshot
The iterator sees the collection as it existed when the iterator was created
Lesson 1305What Is Fail-Safe Behavior?
Wrapping
lets you create a new exception that carries the original exception as its *cause*.
Lesson 769Wrapping Exceptions: throw new Exception(cause)
Write-heavy workloads
Performance degrades as contention increases, especially if writes concentrate on few keys.
Lesson 1165Performance Characteristics: Read vs Write Operations
Writing is dangerous
because Java can't verify type safety.
Lesson 929Wildcard Capture and Reading from <?> Collections
Writing is forbidden
Any attempt to modify them breaks the effectively final contract
Lesson 634Accessing Local Variables from Local Classes
Wrong bucket searched
`HashMap` looks in bucket 67890, finds nothing, returns `null`—even though `alice1.
Lesson 557Demonstrating the Bug: A Step-by-Step Example
Wrong number of arguments
You pass 2 arguments to a method expecting 3
Lesson 2349Type Safety and IllegalArgumentException Risks
Wrong parameter types
(a subtle difference you might miss)
Lesson 423Best Practices: Always Use @Override
Wrong working directory
Running from the wrong folder means relative paths won't resolve correctly.
Lesson 693Common Classpath Issues and ClassNotFoundException

X

XML
offers structured, human-readable data with wide tooling support, though more verbose.
Lesson 2165Alternatives to Java Serialization
XOR (`^`)
Returns 1 only when bits **differ**
Lesson 117The Bitwise XOR Operator (^)

Y

You can combine both
An abstract class can implement one or more interfaces, giving you:
Lesson 532Decision Criteria: A Practical Checklist
You can meaningfully recover
from the error (e.
Lesson 744Propagating vs Handling: When to Catch vs Declare
You cannot add elements
to a `Collection<?
Lesson 950When to Use Unbounded Wildcards
You have enough context
to make the right decision about what to do next
Lesson 744Propagating vs Handling: When to Catch vs Declare
You lack context
to make recovery decisions (e.
Lesson 744Propagating vs Handling: When to Catch vs Declare
You must catch it
with a `try-catch` block, or
Lesson 804Introduction to Checked Exceptions
You must declare it
in your method signature using `throws`
Lesson 804Introduction to Checked Exceptions
You must manually cast
when retrieving, and those casts can fail at runtime
Lesson 884Type Safety Loss with Raw Types
You need duplicates
Use `ArrayList` or `LinkedList`
Lesson 994HashSet: When to Use It
You need immediate visibility
Other processes or users must see the data now
Lesson 1985flush: Forcing Buffer Contents to Disk
You need index access
`HashSet` has no `get(index)` method
Lesson 994HashSet: When to Use It
You need ordering
Use `ArrayList` for insertion order or `TreeSet` for sorted order
Lesson 994HashSet: When to Use It
You need predictable output
(testing, logging, UI display)
Lesson 1083Choosing Between HashSet and LinkedHashSet
You need shared state
Multiple subclasses require common fields or instance variables
Lesson 532Decision Criteria: A Practical Checklist
You need strong encapsulation
to protect internal APIs from misuse by other teams or future maintainers
Lesson 2524Migration Strategy: When to Use Module Path vs Classpath
You want maximum performance
for add/contains/remove operations
Lesson 1083Choosing Between HashSet and LinkedHashSet
Your code deserializes it
, instantiating the attacker's chosen class
Lesson 2161Type Confusion and Class Substitution

Z

Zero doesn't mean empty
`available()` returning `0` doesn't guarantee the stream is at its end—it just means no bytes are immediately ready
Lesson 1909The available() Method and Stream Availability
Zero limit
Splits as many times as possible and **discards** trailing empty strings.
Lesson 2208Limit Parameter in split(): Controlling Array Size
ZonedDateTime
stores a **full time zone** (like `America/New_York` or `Europe/Paris`) along with the date and time.
Lesson 1870OffsetDateTime vs ZonedDateTime