cangjie-std-hashmap

Document Cangjie standard library HashMap construction, operations, and iteration.

2|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/zhenzhizhi12/NexusAgent --skill cangjie-std-hashmap-zhenzhizhi12
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cangjie-std-hashmap
Source: https://github.com/zhenzhizhi12/NexusAgent/tree/main/.opencode/skills/common-skill-l1/hashmap
Command: npx skills add https://github.com/zhenzhizhi12/NexusAgent --skill cangjie-std-hashmap-zhenzhizhi12

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a comprehensive guide to using Cangjie's standard HashMap type, enabling efficient key-value data storage and retrieval.

Core Features & Use Cases

  • Construction: Learn to create HashMaps with default or specified capacities, from collections, or with initialization functions.
  • Operations: Master adding, updating, removing (single, batch, conditional), and querying key-value pairs.
  • Iteration & Traversal: Understand how to iterate over keys, values, or entries, and how to convert to arrays.
  • Capacity Management: Learn to reserve space and understand performance implications.
  • Use Case: Efficiently store and look up configuration settings, user preferences, or cache data where fast access by a unique key is paramount.

Quick Start

Use the cangjie-std-hashmap skill to learn how to construct an empty HashMap with a capacity of 50.

Frequently Asked Questions about cangjie-std-hashmap

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use a HashMap in Cangjie for key-value data storage?

A HashMap in Cangjie provides efficient key-value data storage, requiring keys to implement Hashable and Equatable and values to implement Equatable. You can construct it with default or specified capacities and perform fast lookups by unique keys.

What do I need to implement in Cangjie to use custom objects as HashMap keys?

To use custom objects as HashMap keys in Cangjie, your key type must implement the Hashable and Equatable interfaces. Values must implement Equatable, and ToString is required for certain operations like string conversion.

How do I remove elements from a Cangjie HashMap conditionally during iteration?

Cangjie HashMap supports conditional removal of elements alongside single and batch deletions. You can iterate over entries and apply specific criteria to selectively remove key-value pairs from the collection.

Does Cangjie HashMap support capacity management and pre-allocation?

Cangjie HashMap supports capacity management, allowing you to construct the map with a specified capacity and reserve space dynamically. This helps optimize performance when the expected number of elements is known in advance.

How can I iterate over Cangjie HashMap entries and convert them to arrays?

Cangjie HashMap supports iteration over keys, values, and entries, enabling traversal of the key-value store. You can also convert the collection elements into arrays for downstream processing or integration with other data structures.