Java Course Glossary
Java Course Glossary
A comprehensive guide to modern Java terminology, syntax, and concepts.
A
Annotation Interface
A specialized interface used to define annotations. Declared using the @interface keyword.
Annotation Interface
AQS (AbstractQueuedSynchronizer)
A framework for implementing blocking locks and related synchronizers (semaphores, events, etc.) that rely on first-in-first-out (FIFO) wait queues. AQS (AbstractQueuedSynchronizer)
Architecture Testing
Testing to ensure code adheres to architectural rules (e.g., layers, naming). Architecture Testing
ArchUnit
A library for checking the architecture of Java code using any plain Java unit test framework. ArchUnit
Assertion
A statement that a predicate (Boolean-valued function) is true at that point in code execution. Assertion
Assumption
A condition that must be met for a test to be meaningful. If an assumption fails, the test is aborted (skipped), not failed. Assumption
C
CAS (Compare-And-Swap)
A CPU instruction used to achieve synchronization without locks. It updates a variable only if it has the expected value, enabling non-blocking algorithms. CAS
Collector
A utility class (java.util.stream.Collectors) that provides implementations for the Stream.collect operation, such as accumulating elements into a list, set, or map.
Collector
Compact Constructor
A special constructor in a Record that allows validation or normalization of parameters without repeating the parameter list or assignment logic. Compact Constructor
CompletableFuture
A class that implements Future and CompletionStage, enabling asynchronous, non-blocking programming pipelines.
Analogy: Like ordering food at a restaurant. You get a buzzer (the CompletableFuture). You don’t stand at the counter blocking others; you sit down. When the food is ready, the buzzer triggers a callback for you to collect your meal.
Example:
CompletableFuture.supplyAsync(() -> fetchUserData())
.thenAccept(data -> process(data));
CompletableFuture
Consumer
A functional interface (java.util.function.Consumer<T>) that accepts a single input argument and returns no result. Commonly used in forEach operations.
Consumer
D
Deadlock
A situation where two or more threads are blocked forever, each waiting for the other to release a resource.
Real-World Analogy: Imagine two people drawing on a whiteboard. Alice has the marker but needs the eraser. Bob has the eraser but needs the marker. Neither will give up their item until they get the other, so they both wait forever.
Example: Thread A holds Lock 1 and waits for Lock 2. Thread B holds Lock 2 and waits for Lock 1. Deadlock
Dynamic Test
A test generated at runtime by a factory method, allowing for flexible test scenarios. Dynamic Test
E
Effectively Final
A variable or parameter whose value is never changed after it is initialized. Local variables referenced from a lambda expression or anonymous inner class must be effectively final. Effectively Final
Extension Model
The mechanism in JUnit 5 (Jupiter) to extend the framework’s behavior (e.g., callbacks, parameter resolution). Extension Model
F
ForkJoinPool
An ExecutorService for running ForkJoinTasks. It employs a work-stealing algorithm and is the default thread pool used by parallel streams.
ForkJoinPool
Function
A functional interface (java.util.function.Function<T, R>) that accepts one argument and produces a result. Commonly used in map operations.
Function
Functional Interface
An interface with exactly one abstract method, which can be implemented using a Lambda Expression. Marked with @FunctionalInterface.
Functional Interface
I
Immutable
An object whose state cannot be modified after it is created. Records are immutable by default. Immutable
Integration Test
A level of software testing where individual units are combined and tested as a group. Integration Test
Intermediate Operation
An operation on a stream (like filter, map) that returns a new stream. These operations are lazy and are not executed until a terminal operation is invoked.
Intermediate Operation
J
JUnit
A unit testing framework for the Java programming language. JUnit
L
Lambda Expression
A concise way to represent an instance of a functional interface. It provides a clear and compact syntax for writing anonymous methods. Lambda Expression
Livelock
A condition where threads are not blocked but are too busy responding to each other to make progress.
Real-World Analogy: Two people meet in a narrow hallway. Each steps aside to let the other pass, but they step to the same side, blocking each other again. They keep stepping side-to-side indefinitely. Livelock
M
Method Reference
A shorthand syntax (::) for a lambda expression that executes just one existing method.
Method Reference
P
Parameterized Test
A test method that is executed multiple times with different arguments. Parameterized Test
Pattern Matching
A mechanism to check if an object has a specific structure and extract data from it in a single operation. Available for instanceof, switch, and Records.
Pattern Matching
Permitted Subclass
A class explicitly authorized to extend a Sealed Class using the permits clause.
Permitted Subclass
Pipeline
A sequence of aggregate operations on a data source. A stream pipeline consists of a source, zero or more intermediate operations, and a terminal operation. Pipeline
Predicate
A functional interface (java.util.function.Predicate<T>) that accepts one argument and returns a boolean. Commonly used in filter operations.
Predicate
R
ReadWriteLock
A lock that maintains a pair of associated locks, one for read-only operations and one for writing. The read lock may be held simultaneously by multiple reader threads, so long as there are no writers. ReadWriteLock
Record
A concise class declaration for immutable data carriers. Automatically generates equals, hashCode, toString, and accessors.
Record
Record Pattern
A pattern that matches a record type and deconstructs it into its component values. Record Pattern
Reducer
An operation that combines a sequence of elements into a single result by repeated application of a combining operation (e.g., sum, max). Reducer
ReentrantLock
A mutual exclusion lock with the same basic behavior as the implicit monitor lock accessed using synchronized methods and statements, but with extended capabilities (like fairness and interruptibility).
ReentrantLock
S
Sealed Class
A class or interface that restricts which other classes or interfaces may extend or implement it. Defined using the sealed modifier.
Sealed Class
StampedLock
A capability-based lock with three modes for controlling read/write access. It provides an optimistic read mode that is very efficient for read-heavy workloads. StampedLock
Stream
A sequence of elements supporting sequential and parallel aggregate operations. Streams do not store data; they convey data from a source through a pipeline of computational operations. Stream
Supplier
A functional interface (java.util.function.Supplier<T>) that takes no arguments and returns a result.
Supplier
Switch Expression
A switch construct that evaluates to a value and can be assigned to a variable. Uses the yield keyword (or arrow syntax) to return values.
Switch Expression
T
Terminal Operation
An operation on a stream (like forEach, collect, reduce) that produces a result or a side-effect. Invoking a terminal operation traverses the stream pipeline and consumes the stream.
Terminal Operation
Testcontainers
A Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container. Testcontainers
Text Block
A multi-line string literal in Java, delimited by triple quotes """, that preserves formatting and eliminates the need for most escape sequences.
Text Block
U
Unit Test
A type of software testing where individual units or components of a software are tested. Unit Test
V
Var
A reserved type name for local variable type inference. The compiler infers the type of the variable from the initializer. Var
Virtual Thread
A lightweight thread implementation provided by the JVM (Project Loom) that maps many virtual threads to a small number of carrier OS threads, enabling high-concurrency applications.
Analogy: Like a single postal worker (OS thread) handling thousands of mailboxes (Virtual Threads). When one mailbox is empty (waiting on I/O), the worker instantly switches to another mailbox rather than standing idle.
Example:
Thread.startVirtualThread(() -> {
System.out.println("Running in a virtual thread!");
});
Virtual Thread
W
Work-Stealing
An algorithm used by ForkJoinPool where idle threads “steal” tasks from the deque of busy threads to ensure efficient CPU utilization.
Work-Stealing
Y
Yield
A context-sensitive keyword used in Switch Expressions to return a value from a case block (similar to return in a method).