Double.max(): the greater of two double values
Double.max(a, b) returns the greater of two double values, with special rules for NaN and signed zero.
CKTIS / Knowledge base
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
Double.max(a, b) returns the greater of two double values, with special rules for NaN and signed zero.
Build a stream of primitive doubles, select CPU loads at or above `0.50`, and calculate the count and mean separately for all readings and for high readings.
Create a duration from a minute count or two points in time, add another duration, and read the total in minutes or hours.
Build a transition map for a single enum type, read and update mappings, and iterate over entries in enum declaration order. Learn when a null lookup means a transition is missing.
Create an empty EnumMap with Day.class, store and retrieve values, and see why replacing a value for an existing key does not change the number of entries.
Enum.name() returns an enum constant's identifier exactly as declared. Unlike toString(), it cannot be overridden.
Enum.ordinal returns an enum constant's zero-based declaration position. Do not treat it as a persistent identifier.
Use `add`, `contains`, and `remove` to manage one enum-based permission set in Java SE 21. Iteration follows the order of the enum declarations, not the order of insertion.
Create an initially nonempty, mutable set of constants from one enum type. Distinguish collector characteristics from a spliterator’s bit mask.
Create mutable sets of constants from one enum type, and tell apart a membership result from a report that the set changed.
EnumClass.values() returns an array of all constants of an enum in declaration order. Use it to visit them in a for loop.
ExecutionException is a checked exception thrown when retrieving the result of a task that terminated with an exception. It separates task failure from the code receiving the result; getCause() lets you inspect the underlying cause.
Create two pools with two workers each, compare their queue limits, and collect task results before calling `shutdown()` on both pools.
A pool of size 3 can handle at most three tasks concurrently. It does not make them start at the same instant. Additional tasks wait in a queue when all workers are busy.
Identify an annotated field, read its declared type, and assign a constructed dependency while respecting Java SE 21 access rules.
Learn how to establish a Flow subscription in Java SE 21, receive items with bounded demand, and distinguish normal completion, failure, and cancellation.
Flow.Publisher<T> describes a source of items received by subscribers. Its subscribe method connects a receiver to the source, while Flow.Subscription lets the receiver request items and cancel delivery.
Flow.Subscriber<T> receives items and terminal signals from a publisher. Its subscription lets it express demand through request(n), allowing the receiver to control how many items are delivered.
Flow.Subscription controls item delivery between a publisher and a subscriber. request(long n) increases demand, while cancel() ends reception without guaranteeing that delivery stops immediately.
ForkJoinPool executes tasks using work-stealing. Learn synchronous invoke, the shared commonPool, and the lifecycle rules for shutting down an owned pool with shutdown.
ForkJoinPool.commonPool() returns the shared fork/join pool, rather than creating a new pool for each call.
ForkJoinTask represents a task executed by ForkJoinPool. Learn scheduling with fork(), retrieving results with join(), and group execution with invokeAll() through an example that splits a sum into subtasks.
`Function.andThen` returns a composed function that runs the receiver first and passes its result to the `after` function.
`apply` takes one argument and returns the function's result. Use it to call a single function or run a previously composed chain of functions.