FIND YOUR NEXT FEW LINES

Results for “Java”

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

257 snippets foundClear filters
JavaGetting Started

Read one character from ASCII text

Java: Use a valid zero-based index to read the first character.

Java✓ Tested
JavaScriptGetting Started

Read one character from ASCII text

JavaScript: Use a valid zero-based index to read the first character.

JavaScript✓ Tested
JavaGetting Started

Read the beginning of a text value

Java: Extract or display the first three ASCII characters from a known nonempty string.

Java✓ Tested
JavaScriptGetting Started

Read the beginning of a text value

JavaScript: Extract or display the first three ASCII characters from a known nonempty string.

JavaScript✓ Tested
JavaScriptArray traversal & selection

Read the final array item with a negative index

JavaScript: at supports negative positions counted from the end.

JavaScript✓ Tested
JavaGetting Started

Read the first collection element

Java: Access index zero only after establishing that the collection is nonempty.

Java✓ Tested
JavaScriptGetting Started

Read the first collection element

JavaScript: Access index zero only after establishing that the collection is nonempty.

JavaScript✓ Tested
JavaScriptPromises & iteration protocols

Recover from an expected promise rejection

JavaScript: Return a fallback from catch so later handlers receive an ordinary resolved value.

JavaScript✓ Tested
JavaPrecise numeric calculations

Reject nonfinite floating-point values

Java: Double.isFinite excludes both infinity and NaN.

Java✓ Tested
JavaScriptObject behavior & collections

Remove a Map entry and detect whether it existed

JavaScript: Map.delete returns true only when an entry was present.

JavaScript✓ 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
JavaCollections

Remove duplicate values

Preserve encounter order while removing repeated Java list values.

Java✓ Tested