FIND YOUR NEXT FEW LINES

Results for “collection”

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

146 snippets foundClear filters
TypeScriptCollections & records

Filter and transform an array

Keep active objects and extract their names.

filter✓ Tested
C#Collections

Filter even numbers

Use LINQ Where to keep even C# values.

C#✓ Tested
JavaCollections

Filter even numbers

Use a Java stream to collect only even values.

Java✓ Tested
PowerShellCollections & objects

Filter items in a pipeline

Keep numbers that meet a condition.

Where-Object✓ Tested
PowerShellStrings & literal text

Join several strings with a separator

PowerShell: The join operator returns one string from an input collection.

PowerShell✓ Tested
C#Collections

Look up a dictionary value

Use TryGetValue for a C# dictionary lookup with a fallback.

C#✓ Tested
C++Collections

Look up a map key

Use find to read a C++ map without inserting a missing key.

C++✓ Tested
PythonCollections

Merge two dictionaries

Combine two dictionaries into a new dictionary. When a key appears in both inputs, the value from the second dictionary wins.

dictionary✓ Tested
PowerShellArray operations

Pair corresponding values from two arrays

PowerShell: Check lengths before indexing to reject mismatched input collections.

PowerShell✓ Tested
JavaCollections

Read a map with a default

Return a fallback when a Java map does not contain a key.

Java✓ Tested
C#Collections

Remove duplicate values

Use LINQ Distinct and OrderBy for a sorted C# result.

C#✓ Tested
JavaCollections

Remove duplicate values

Preserve encounter order while removing repeated Java list values.

Java✓ Tested