Results for “transform”
Small, practical examples. Search by task or narrow things down below.
Flatten nested collections
Flatten nested collections in a complete Rust program using the standard library.
Rust✓ Tested
Flatten nested collections with SelectMany
C#: Concatenate the items from several sequences into one sequence.
C#✓ Tested
Group strings by their length
Java: Choose a TreeMap supplier when group keys must have deterministic order.
Java✓ Tested
Index records by a unique key
Java: Use toMap with an explicit merge rule so duplicate keys have defined behavior.
Java✓ Tested
Insert into an array with spare capacity
C: Move the trailing elements before inserting and keep the logical length separate from capacity.
C✓ Tested
Join lines from two files side by side
Linux Commands: Use paste to pair lines by position with a chosen separator.
Linux Commands✓ Tested
Merge two sorted arrays
C: Advance the pointer belonging to the smaller next element and copy any remaining suffix.
C✓ Tested
Number items while iterating
Number items while iterating in a complete Rust program using the standard library.
Rust✓ Tested
Pair corresponding collection elements
C#: Zip stops at the shorter sequence, so validate lengths separately if mismatches are an error.
C#✓ Tested
Pair corresponding values
Pair corresponding values in a complete Rust program using the standard library.
Rust✓ Tested
Parse only valid integers
Parse only valid integers in a complete Rust program using the standard library.
Rust✓ Tested
Partition a collection by a predicate
Java: Use partitioningBy to retain both matching and nonmatching values.
Java✓ Tested