Results for “Collections & data structures”
Small, practical examples. Search by task or narrow things down below.
Remove a Map entry and detect whether it existed
TypeScript: Map.delete returns true only when an entry was present.
TypeScript✓ Tested
Remove a slice range
Remove a slice range using a complete Go program with explicit sample inputs.
Go✓ Tested
Remove one network attachment
Docker / Compose: network disconnect removes the specified attachment while retaining the container.
Docker / Compose✓ Tested
Render an observable with AsyncPipe
Render an observable with AsyncPipe with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Represent a small set of named states
C: An enum gives symbolic names to integer state values.
C✓ Tested
Resolve a peer’s name on a user-defined network
Docker / Compose: The embedded DNS service resolves names on user-defined bridges.
Docker / Compose✓ Tested
Resolve relative links against an explicit base
HTML: A base href changes how relative document URLs are resolved.
HTML✓ Tested
Return a small immutable named record
Python: Use NamedTuple when callers need both tuple behavior and named fields.
Python✓ Tested
Return a status separately from a calculated result
C: An output pointer lets a function return success or failure independently of its numeric result.
C✓ Tested
Reverse slice order
Reverse slice order using a complete Go program with explicit sample inputs.
Go✓ Tested
Set several inline styles together
jQuery: Pass a property-value object to css.
jQuery✓ Tested
Sort integers in place
Sort integers in place using a complete Go program with explicit sample inputs.
Go✓ Tested