
Compact, insertion-order-preserving hash table enabling lookup by key or numerical index, fast iteration, and memory-efficient dense storage; order only changes with removals or swap operations.
This is a Kotlin Multiplatform line-by-line transliteration port of indexmap-rs/indexmap.
Original Project: This port is based on indexmap-rs/indexmap. All design credit and project intent belong to the upstream authors; this repository is a faithful port to Kotlin Multiplatform with no behavioural changes intended.
This is an in-progress port. The goal is feature parity with the upstream Rust crate while providing a native Kotlin Multiplatform API. Every Kotlin file carries a // port-lint: source <path> header naming its upstream Rust counterpart so the AST-distance tool can track provenance.
The text below is reproduced and lightly edited from
https://github.com/indexmap-rs/indexmap. It is the upstream project's own description and remains under the upstream authors' authorship; links have been rewritten to absolute upstream URLs so they continue to resolve from this repository.
A pure-Rust hash table which preserves (in a limited sense) insertion order.
This crate implements compact map and set data-structures, where the iteration order of the keys is independent from their hash or value. It preserves insertion order (except after removals), and it allows lookup of entries by either hash table key or numerical index.
Note: this crate was originally released under the name ordermap,
but it was renamed to indexmap to better reflect its features.
The ordermap crate now exists
as a wrapper over indexmap with stronger ordering properties.
This was inspired by Python 3.6's new dict implementation (which remembers the insertion order and is fast to iterate, and is compact in memory).
Some of those features were translated to Rust, and some were not. The result was indexmap, a hash table that has following properties:
.remove(),
.swap_remove(), or other methods that explicitly change order.
The alternate .shift_remove() does preserve relative order.HashMap does.IndexMap derives a couple of performance facts directly from how it is constructed,
which is roughly:
A raw hash table of key-value indices, and a vector of key-value pairs.
Iteration is very fast since it is on the dense key-values.
Removal is fast since it moves memory areas only in the table, and uses a single swap in the vector.
Lookup is fast-ish because the initial 7-bit hash lookup uses SIMD, and indices are densely stored. Lookup also is slow-ish since the actual key-value pairs are stored separately. (Visible when cpu caches size is limiting.)
In practice, IndexMap has been tested out as the hashmap in rustc in PR45282 and
the performance was roughly on par across the whole workload.
If you want the properties of IndexMap, or its strongest performance points
fits your workload, it might be the best hash table implementation.
See RELEASES.md.
dependencies {
implementation("io.github.kotlinmania:indexmap-kotlin:0.1.4")
}./gradlew build
./gradlew testSee AGENTS.md for translator discipline, port-lint header convention, and Rust → Kotlin idiom mapping.
This Kotlin port is distributed under the same Apache-2.0 license as the upstream indexmap-rs/indexmap. See LICENSE (and any sibling LICENSE-* / NOTICE files mirrored from upstream) for the full text.
Original work copyrighted by the indexmap authors.
Kotlin port: Copyright (c) 2026 Sydney Renee and The Solace Project.
Thanks to the indexmap-rs/indexmap maintainers and contributors for the original Rust implementation. This port reproduces their work in Kotlin Multiplatform; bug reports about upstream design or behavior should go to the upstream repository.
This is a Kotlin Multiplatform line-by-line transliteration port of indexmap-rs/indexmap.
Original Project: This port is based on indexmap-rs/indexmap. All design credit and project intent belong to the upstream authors; this repository is a faithful port to Kotlin Multiplatform with no behavioural changes intended.
This is an in-progress port. The goal is feature parity with the upstream Rust crate while providing a native Kotlin Multiplatform API. Every Kotlin file carries a // port-lint: source <path> header naming its upstream Rust counterpart so the AST-distance tool can track provenance.
The text below is reproduced and lightly edited from
https://github.com/indexmap-rs/indexmap. It is the upstream project's own description and remains under the upstream authors' authorship; links have been rewritten to absolute upstream URLs so they continue to resolve from this repository.
A pure-Rust hash table which preserves (in a limited sense) insertion order.
This crate implements compact map and set data-structures, where the iteration order of the keys is independent from their hash or value. It preserves insertion order (except after removals), and it allows lookup of entries by either hash table key or numerical index.
Note: this crate was originally released under the name ordermap,
but it was renamed to indexmap to better reflect its features.
The ordermap crate now exists
as a wrapper over indexmap with stronger ordering properties.
This was inspired by Python 3.6's new dict implementation (which remembers the insertion order and is fast to iterate, and is compact in memory).
Some of those features were translated to Rust, and some were not. The result was indexmap, a hash table that has following properties:
.remove(),
.swap_remove(), or other methods that explicitly change order.
The alternate .shift_remove() does preserve relative order.HashMap does.IndexMap derives a couple of performance facts directly from how it is constructed,
which is roughly:
A raw hash table of key-value indices, and a vector of key-value pairs.
Iteration is very fast since it is on the dense key-values.
Removal is fast since it moves memory areas only in the table, and uses a single swap in the vector.
Lookup is fast-ish because the initial 7-bit hash lookup uses SIMD, and indices are densely stored. Lookup also is slow-ish since the actual key-value pairs are stored separately. (Visible when cpu caches size is limiting.)
In practice, IndexMap has been tested out as the hashmap in rustc in PR45282 and
the performance was roughly on par across the whole workload.
If you want the properties of IndexMap, or its strongest performance points
fits your workload, it might be the best hash table implementation.
See RELEASES.md.
dependencies {
implementation("io.github.kotlinmania:indexmap-kotlin:0.1.4")
}./gradlew build
./gradlew testSee AGENTS.md for translator discipline, port-lint header convention, and Rust → Kotlin idiom mapping.
This Kotlin port is distributed under the same Apache-2.0 license as the upstream indexmap-rs/indexmap. See LICENSE (and any sibling LICENSE-* / NOTICE files mirrored from upstream) for the full text.
Original work copyrighted by the indexmap authors.
Kotlin port: Copyright (c) 2026 Sydney Renee and The Solace Project.
Thanks to the indexmap-rs/indexmap maintainers and contributors for the original Rust implementation. This port reproduces their work in Kotlin Multiplatform; bug reports about upstream design or behavior should go to the upstream repository.