### Install Dependencies Source: https://github.com/mgm-tp/a12-utils/blob/main/README.md Install all project dependencies using pnpm. Ensure Node.js (^24) and pnpm (^10.6) are installed as prerequisites. ```sh pnpm install ``` -------------------------------- ### Install Collections Package Source: https://github.com/mgm-tp/a12-utils/blob/main/README.md Install the latest npm package for collections utility functions using npm or pnpm. ```sh npm install @com.mgmtp.a12.utils/utils-collections ``` -------------------------------- ### HashMap Usage Example Source: https://github.com/mgm-tp/a12-utils/blob/main/collections/README.md Demonstrates basic operations of HashMap, including setting values, checking for existence, retrieving values, and clearing the map. Requires custom hash and equality functions. ```javascript import { TestData, TestHashFunction, getHash } from "./TestData"; const hashMap = new HashMap( TestHashFunction, ReferenceEquals ); const val: TestData = { i: 1, hash: getHash(1, 100) }; hashMap.set(val, 1); const old = hashMap.setAndRetrieve(val, 2); const hasValue: Boolean = hashMap.has(val); hashMap.get(val); const size = hashMap.size; hashMap.clear(); ``` -------------------------------- ### HashSet Usage Example Source: https://github.com/mgm-tp/a12-utils/blob/main/collections/README.md Demonstrates adding elements, attempting to add duplicates, deleting elements, checking for existence, and clearing a HashSet. Requires custom hash and equality functions. ```javascript import { TestData, TestHashFunction, getHash } from "./TestData"; import { DefaultHashFunc, ReferenceEquals } from "./Hash.utility"; const hashSet = new HashSet( TestHashFunction, ReferenceEquals ); const val: TestData = { i: 1, hash: 1 }; hashSet.add(TestData); let ableToAdd: Boolean = hashSet.tryAdd(val); hashSet.delete(val); const hasValue: Boolean = hashSet.has(val); hashSet.clear(); ``` -------------------------------- ### Install A12 Collections Codemod Source: https://github.com/mgm-tp/a12-utils/blob/main/collections-documentation/src/index.adoc Install the codemod utility for migrating deep imports to top-level imports in the A12 Collections npm package. ```bash pnpm install -g @com.mgmtp.a12.utils/utils-collections-codemod ``` -------------------------------- ### ComparativeSortedMap Usage Example Source: https://github.com/mgm-tp/a12-utils/blob/main/collections/README.md Illustrates the use of ComparativeSortedMap with a custom comparer function for object keys. Shows setting values, checking for existence, retrieving values, and clearing the map. ```javascript function comparer(a: TestData, b: TestData) { return a.i - b.i; } const map = new ComparativeSortedMap( comparer ); const val: TestData = { i: 1, hash: getHash(1, 100) }; const secondVal: TestData = { i: 2, hash: 1 }; map.set(val, 1); const bool: booelan = map.has(val)); const storedValue = map.get(val); map.set(secondVal, 2); map.clear(); ``` -------------------------------- ### ComparativeSortedSet Usage Example Source: https://github.com/mgm-tp/a12-utils/blob/main/collections/README.md Shows how to use ComparativeSortedSet with a custom comparer function. Includes adding elements, attempting to add duplicates, deleting, checking for existence, retrieving entries, converting to string, clearing, and checking if empty. ```javascript function comparer(a: TestData, b: TestData) { return a.i - b.i; } const comparativeSet = new ComparativeSortedSet( comparer ); const val: TestData = { i: 1, hash: getHash(1, 100) }; comparativeSet.tryAdd(val); comparativeSet.delete(val); const hasValue: Boolean = comparativeSet.has(val); const entries = set.entries(); const string: String = comparativeSet.toString(); comparativeSet.clear(); const isEmpty: Boolean = comparativeSet.isEmpty(); ``` -------------------------------- ### Run Tests Source: https://github.com/mgm-tp/a12-utils/blob/main/README.md Execute the project's test suite. This command verifies the functionality and stability of the collections package. ```sh pnpm test ``` -------------------------------- ### Compile Project Source: https://github.com/mgm-tp/a12-utils/blob/main/README.md Compile the project to build the necessary artifacts. This command can be run from the repository root or individual sub-project folders. ```sh pnpm compile ``` -------------------------------- ### Run A12 Collections Codemod Source: https://github.com/mgm-tp/a12-utils/blob/main/collections-documentation/src/index.adoc Execute the codemod to update deep import paths to top-level imports within your project. Use the --help flag for more options. ```bash utils-collections-codemod preferTopLevel ``` ```bash pnpx @com.mgmtp.a12.utils/utils-collections-codemod preferTopLevel ``` -------------------------------- ### Verify Code Quality Source: https://github.com/mgm-tp/a12-utils/blob/main/README.md Run code quality checks, including linting and formatting, to ensure adherence to project standards. ```sh pnpm verify ``` -------------------------------- ### Clean Build Artifacts Source: https://github.com/mgm-tp/a12-utils/blob/main/README.md Remove generated build artifacts from the project. This is useful for ensuring a clean build environment. ```sh pnpm clean ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.