Results for “Queues & collection operations”
Small, practical examples. Search by task or narrow things down below.
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
Pair corresponding values from two arrays
PowerShell: Check lengths before indexing to reject mismatched input collections.
PowerShell✓ Tested
Use a last-in first-out stack
C#: Stack is useful for reversible traversal and other nested operations.
C#✓ Tested
Add a dictionary entry only if absent
C#: TryAdd reports a duplicate key without replacing its existing value.
C#✓ Tested