FIND YOUR NEXT FEW LINES

Results for “collect”

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

164 snippets foundClear filters
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
jQueryTraversal & selection

Read checked options

Collect checked checkbox values with jQuery map and get.

jQuery✓ 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
TypeScriptCollections & records

Remove duplicate values with a Set

Keep the first occurrence order while deduplicating.

Set✓ Tested
PythonCollections

Remove duplicates from a list

Remove repeated hashable values while preserving the order in which they first appeared.

list✓ Tested
C++Collections

Remove odd values

Use the erase-remove idiom to filter a C++ vector in place.

C++✓ Tested
jQueryTraversal & selection

Select an element by zero-based position

jQuery: eq returns a jQuery collection containing the selected index.

jQuery✓ Tested
PowerShellCollections & objects

Select object properties

Create a smaller object with only the fields you need.

Select-Object✓ Tested
JavaCollections

Sort a list

Sort a mutable Java list in natural ascending order.

Java✓ Tested
C++Collections

Sort a vector

Sort C++ integer values in ascending order.

C++✓ Tested