FIND YOUR NEXT FEW LINES

Results for “queue”

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

29 snippets foundClear filters
JavaQueues & collection operations

Find set members missing from another set

Java: Use removeAll on a copy to calculate a set difference.

Java✓ Tested
JavaQueues & collection operations

Find shared set members

Java: Copy a set before retainAll when the original must remain unchanged.

Java✓ Tested
JavaQueues & collection operations

Initialize a map entry only when absent

Java: Use computeIfAbsent when creating a collection for a new key.

Java✓ Tested
jQueryDeferred work & queues

Inspect a deferred’s lifecycle state

jQuery: state reports pending, resolved, or rejected.

jQuery✓ Tested
JavaQueues & collection operations

Locate a value in a sorted array

Java: Use Arrays.binarySearch only after establishing ascending order.

Java✓ Tested
JavaQueues & collection operations

Preserve map insertion order

Java: Use LinkedHashMap when iteration should follow the order keys were first added.

Java✓ Tested
jQueryDeferred work & queues

Reject a deferred result

jQuery: fail receives the reason supplied to reject.

jQuery✓ Tested
JavaQueues & collection operations

Remove collection items that satisfy a condition

Java: Use removeIf on a mutable collection to avoid changing it manually inside a for-each loop.

Java✓ Tested
jQueryDeferred work & queues

Report progress before completion

jQuery: notify calls registered progress handlers while the deferred is pending.

jQuery✓ Tested
jQueryDeferred work & queues

Resolve a deferred result

jQuery: done receives the value supplied to resolve.

jQuery✓ Tested
JavaQueues & collection operations

Take an immutable list snapshot

Java: List.copyOf protects the snapshot from later changes to the source list.

Java✓ Tested
jQueryDeferred work & queues

Transform a deferred value with then

jQuery: then returns a new promise with the callback’s result.

jQuery✓ Tested