Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Java

Knowledge base — Java

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 813

Java

util.concurrent.atomic.AtomicBoolean: practical reference

util.concurrent.atomic.AtomicBoolean: practical reference: AtomicBoolean provides atomic boolean reads, writes, compare-and-set, and memory-effect variants.

Advanced · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

AtomicInteger — atomic operations on int

AtomicInteger provides atomic operations on a single int value shared between threads. Learn reading, writing, incrementing, and conditional updates, including the limits of atomicity.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

AtomicLong — an atomic long counter

AtomicLong holds one long value and provides atomic updates shared by threads. Its incrementAndGet() method increases the value by one and returns the updated result.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

AtomicReference — updating a reference atomically

AtomicReference<V> provides atomic operations on one reference. Learn how get(), conditional compareAndSet(), and unconditional getAndSet() differ, and why object identity rather than content equality determines whether a conditional replacement succeeds.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

LongAccumulator — concurrent aggregation of long values

LongAccumulator combines long values using a supplied function. It supports concurrent updates, but get() does not provide an atomic snapshot while updates are occurring.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

LongAdder — concurrent counting and summation

LongAdder maintains a long sum updated by multiple threads. It suits statistics, but sum() does not provide an atomic snapshot, and resetting requires control over concurrent updates.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

BlockingQueue — a queue with waiting operations

BlockingQueue<E> supports safe exchange of elements between threads, such as a producer and a consumer. It distinguishes operations that do not wait for space or elements, waiting operations, and timed variants. The example uses an ArrayBlockingQueue with capacity 1.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

util.concurrent.Callable: practical reference

util.concurrent.Callable: practical reference: Callable<V> is a functional interface for a no-argument task that returns V and may throw Exception.

Advanced · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

CompletableFuture — composing asynchronous computations

CompletableFuture<T> represents a future result and lets you connect dependent stages without blocking after every step. Learn transformations, composition, result combination, error recovery, and timeouts in Java SE 21.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

util.concurrent.CompletionService: practical reference

util.concurrent.CompletionService: practical reference: CompletionService<V> separates task submission from retrieving Future results in completion order.

Advanced · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

util.concurrent.CompletionStage: practical reference

util.concurrent.CompletionStage: practical reference: CompletionStage<T> describes a computation stage that performs an action or computes a value when another stage completes.

Advanced · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

ConcurrentHashMap — a concurrent key–value map

ConcurrentHashMap lets multiple threads safely use a shared map. Atomic operations for a key do not, however, turn a sequence of calls into a transaction.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

ConcurrentLinkedQueue — concurrent FIFO queue

Learn ConcurrentLinkedQueue and its add, isEmpty, and poll methods for insertion, empty checks, and safe retrieval.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

util.concurrent.CopyOnWriteArrayList: practical reference

util.concurrent.CopyOnWriteArrayList: practical reference: CopyOnWriteArrayList<E> is a thread-safe list that copies its entire backing array on every mutation.

Advanced · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

CountDownLatch — one-shot waiting for signals

CountDownLatch coordinates threads: await() waits until countDown() calls reduce the count to zero. It supports waiting for a group of operations and guarantees visibility of earlier writes.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

CyclicBarrier — cyclic thread synchronization

CyclicBarrier synchronizes a fixed number of participants at successive phase boundaries. Calling await() waits for the others; an optional action combines results before the next phase begins.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Executor — separating tasks from execution policy

java.util.concurrent.Executor accepts Runnable tasks through execute. It separates task submission from execution policy; it guarantees neither a separate thread nor asynchronous execution.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Executors — creating a fixed-size thread pool

java.util.concurrent.Executors provides factory methods for task executors. Executors.newFixedThreadPool limits the number of active worker threads, but not the queue size. Learn how to retrieve results and close the pool in Java SE 21.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

ExecutorService — tasks, results, and shutdown

ExecutorService separates task submission from execution management. Learn submit, bulk execution with invokeAll, and shutdown, including the distinction between requesting shutdown and waiting for termination.

Intermediate · Java SE 21 (repository runtime); production runtime not attested
Java

util.concurrent.Flow: practical reference

util.concurrent.Flow: practical reference: Flow groups Reactive Streams-compatible Publisher, Subscriber, Subscription, and Processor interfaces with demand control.

Advanced · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Future — an asynchronous task result

Future<V> represents an asynchronous task result. Future.get retrieves the result, waiting if necessary, while Future.isDone checks completion, which does not necessarily mean success.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

LinkedBlockingQueue — a blocking FIFO queue

LinkedBlockingQueue is a thread-safe FIFO queue built from linked nodes. It supports an optional capacity bound and operations that wait for space or an element, making it useful for producer–consumer communication.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Condition — waiting for lock-protected state

Condition lets a thread wait for a change to shared state protected by a Lock. Learn await, awaitNanos, signal, and signalAll, and why the state check belongs in a loop.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Lock — explicit lock acquisition and release

The java.util.concurrent.locks.Lock interface provides explicit control over locking. Learn the lock()/unlock() pair, the safe try/finally pattern, and an example using ReentrantLock to protect a shared counter.

Intermediate · Java SE 21; repository runtime, production runtime not attested