cangjie-collections

Explain Cangjie collection types, construction, access, modification, and iteration.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a comprehensive guide to understanding and utilizing the core collection types in the Cangjie language, including their construction, access, modification, and iteration mechanisms.

Core Features & Use Cases

  • Collection Types: Covers Array, ArrayList, HashSet, and HashMap.
  • Operations: Details construction, element access (by index or key), modification (add, remove, update), and iteration (for-in loops).
  • Semantics: Explains reference semantics for mutable collections and the Iterable/Iterator interfaces.
  • Use Case: When developing in Cangjie and needing to store and manage groups of data, such as lists of user IDs, key-value pairs for configuration, or unique sets of tags, this Skill will clarify which collection type to use and how to implement it.

Quick Start

Explain how to create an ArrayList of strings in Cangjie.

Frequently Asked Questions about cangjie-collections

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

FAQPage Schema
How do I create an ArrayList of strings in Cangjie?

Cangjie provides fundamental collection types including Array, ArrayList, HashSet, and HashMap for storing and managing groups of data. Use Array for fixed-size sequences, ArrayList for dynamic lists, HashSet for unique elements, and HashMap for key-value pairs.

How do I iterate over collection elements in Cangjie?

Cangjie iterates over collection elements using the Iterable and Iterator interfaces, enabling for-in loops across Array, ArrayList, HashSet, and HashMap to traverse stored data uniformly.

What is the difference between Array and ArrayList in Cangjie?

Array represents a fixed-size sequence, whereas ArrayList provides dynamic resizing for adding and removing elements. This Skill explains their distinct construction, modification operations, and reference semantics for mutable collections.

How do I handle generic constraints and type safety for HashMap keys in Cangjie?

Cangjie enforces type safety on collections by applying generic constraints to elements and keys. This Skill details how to ensure type consistency when constructing and modifying HashMap and HashSet structures.

Does Cangjie support reference semantics for mutable collections?

Cangjie supports reference semantics for mutable collections like ArrayList, meaning modifications affect shared references. This Skill clarifies how these semantics impact element access and updates during data management.