FIND YOUR NEXT FEW LINES

Results for “Java”

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

257 snippets foundClear filters
JavaScriptArray traversal & selection

Iterate with array indices and values

JavaScript: entries provides each position and value without a separate counter.

JavaScript✓ Tested
JavaStrings

Join strings with a separator

Build a Java string from several values using String.join.

Java✓ Tested
JavaStream transformations

Join transformed stream values

Java: Use Collectors.joining after converting elements to strings.

Java✓ Tested
JavaScriptArray restructuring

Keep both matching and rejected values

JavaScript: Use two explicit outputs when a caller needs both sides of a classification.

JavaScript✓ Tested
JavaScriptObject behavior & collections

List an object’s own enumerable keys

JavaScript: Object.keys omits inherited and non-enumerable properties.

JavaScript✓ Tested
JavaFiles & paths

List regular files

List immediate regular files in sorted order and close the Java directory stream.

Java✓ Tested
JavaFile operations & binary data

Load a small properties configuration

Java: Use a Reader to make the configuration character encoding explicit.

Java✓ Tested
JavaQueues & collection operations

Locate a value in a sorted array

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

Java✓ Tested
JavaScriptArray restructuring

Map items to multiple output values

JavaScript: flatMap combines mapping and a one-level flattening operation.

JavaScript✓ Tested
JavaDates & time zones

Measure a duration between instants

Java: Use Duration for elapsed timeline time and retrieve total seconds.

Java✓ Tested
JavaGetting Started

Measure a short text value

Java: Read the length of an ASCII string. Non-ASCII text may use multiple code units or bytes depending on the language.

Java✓ Tested
JavaScriptGetting Started

Measure a short text value

JavaScript: Read the length of an ASCII string. Non-ASCII text may use multiple code units or bytes depending on the language.

JavaScript✓ Tested