Results for “collect”
Small, practical examples. Search by task or narrow things down below.
Pair corresponding values from two arrays
PowerShell: Check lengths before indexing to reject mismatched input collections.
PowerShell✓ Tested
Read a map with a default
Return a fallback when a Java map does not contain a key.
Java✓ Tested
Read checked options
Collect checked checkbox values with jQuery map and get.
jQuery✓ Tested
Remove duplicate values
Use LINQ Distinct and OrderBy for a sorted C# result.
C#✓ Tested
Remove duplicate values
Preserve encounter order while removing repeated Java list values.
Java✓ Tested
Remove duplicate values with a Set
Keep the first occurrence order while deduplicating.
Set✓ Tested
Remove duplicates from a list
Remove repeated hashable values while preserving the order in which they first appeared.
list✓ Tested
Remove odd values
Use the erase-remove idiom to filter a C++ vector in place.
C++✓ Tested
Select an element by zero-based position
jQuery: eq returns a jQuery collection containing the selected index.
jQuery✓ Tested
Select object properties
Create a smaller object with only the fields you need.
Select-Object✓ Tested
Sort a list
Sort a mutable Java list in natural ascending order.
Java✓ Tested
Sort a vector
Sort C++ integer values in ascending order.
C++✓ Tested