FIND YOUR NEXT FEW LINES

Results for “control”

Small, practical examples. Search by task or narrow things down below.

112 snippets foundClear filters
JavaRecords & reliable control flow

Run a task on an executor and close it

Java: Java 21 ExecutorService supports try-with-resources to shut down after submitted work.

Java✓ Tested
JavaRecords & reliable control flow

Run cleanup after a handled exception

Java: A finally block executes whether the protected operation succeeds or fails.

Java✓ Tested
AngularLists & control flow

Sort a derived copy of a collection

Sort a derived copy of a collection with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
jQueryEvent control

Stop a child event from reaching its parent

jQuery: stopPropagation leaves other handlers on the same element intact.

jQuery✓ Tested
AngularLists & control flow

Style the first and last list items

Style the first and last list items with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
AngularLists & control flow

Track a selected record by its identifier

Track a selected record by its identifier with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
JavaRecords & reliable control flow

Transform an asynchronous result

Java: Chain thenApply and join a CompletableFuture to retrieve the completed value.

Java✓ Tested
JavaRecords & reliable control flow

Transform an optional value

Java: Use Optional.map and orElse to transform a possibly absent result.

Java✓ Tested
JavaRecords & reliable control flow

Update a shared counter atomically

Java: AtomicInteger provides an indivisible increment operation for a shared counter.

Java✓ Tested
C#Types & reliable control flow

Use a switch expression to classify a value

C#: Relational patterns express a small ordered range classification.

C#✓ Tested
jQueryEvent control

Validate a field when focus leaves it

jQuery: focusout bubbles and can support delegated form validation.

jQuery✓ Tested
JavaRecords & reliable control flow

Validate a required argument

Java: Use requireNonNull with a useful message at an API boundary.

Java✓ Tested