Results for “collect”
Small, practical examples. Search by task or narrow things down below.
Sum a collection
Calculate a total with Measure-Object.
Measure-Object✓ Tested
Transform a collection into a plain array
jQuery: map followed by get returns ordinary JavaScript values.
jQuery✓ Tested
Transform each item in a collection
Build a result array with a foreach expression.
foreach✓ Tested
Visit every item in a collection
Python: Print each element in the collection’s original order.
Python✓ Tested
Visit every item in a collection
C#: Print each element in the collection’s original order.
C#✓ Tested
Visit every item in a collection
Java: Print each element in the collection’s original order.
Java✓ Tested
Visit every item in a collection
JavaScript: Print each element in the collection’s original order.
JavaScript✓ Tested
Visit every item in a collection
TypeScript: Print each element in the collection’s original order.
TypeScript✓ Tested
Visit every item in a collection
C++: Print each element in the collection’s original order.
C++✓ Tested
Visit every item in a collection
C: Print each element in the collection’s original order.
C✓ Tested
Wrap a collection in one shared parent
jQuery: wrapAll places all selected elements inside one wrapper.
jQuery✓ Tested
Add a dictionary entry only if absent
C#: TryAdd reports a duplicate key without replacing its existing value.
C#✓ Tested