FIND YOUR NEXT FEW LINES

Results for “Map”

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

76 snippets foundClear filters
Docker / ComposeCompose service options

Add a fixed hostname mapping

Docker / Compose: extra_hosts adds an entry to the container’s hosts file.

Docker / Compose✓ Tested
GoMaps & sets

Clear all map entries

Clear all map entries using a complete Go program with explicit sample inputs.

Go✓ Tested
GoMaps & sets

Clone a map before editing it

Clone a map before editing it using a complete Go program with explicit sample inputs.

Go✓ Tested
GoMaps & sets

Compare map contents

Compare map contents using a complete Go program with explicit sample inputs.

Go✓ Tested
GoMaps & sets

Copy entries into another map

Copy entries into another map using a complete Go program with explicit sample inputs.

Go✓ Tested
TypeScriptCollections & records

Count words using a Map

Update a keyed counter without losing its value type.

Map✓ Tested
GoMaps & sets

Delete a map entry

Delete a map entry using a complete Go program with explicit sample inputs.

Go✓ Tested
JavaScriptObject behavior & collections

Group records into map entries

JavaScript: Initialize an array for a missing Map key before appending its values.

JavaScript✓ Tested
TypeScriptObject behavior & collections

Group records into map entries

TypeScript: Initialize an array for a missing Map key before appending its values.

TypeScript✓ Tested
JavaQueues & collection operations

Initialize a map entry only when absent

Java: Use computeIfAbsent when creating a collection for a new key.

Java✓ Tested
C++Containers & compound values

Insert a map value only when a key is absent

C++: try_emplace preserves the old value when insertion does not take place.

C++✓ Tested
RustMaps & sets

Insert and retrieve a map value

Insert and retrieve a map value in a complete Rust program using the standard library.

Rust✓ Tested