FIND YOUR NEXT FEW LINES

Results for “Queues & collection operations”

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

312 snippets foundClear filters
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
CFile positioning & lifecycle

Measure a small seekable binary file

C: Seek to the end and inspect ftell, checking both operations for errors.

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
C#Asynchronous work & URI handling

Observe cancellation through a token

C#: A cancellation token is cooperative; operations must check it or accept it as an argument.

C#✓ 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
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