The type of the custom keys.
The type of the values.
The type of the mapped primitive keys.
An iterable of key-value pairs using the custom key type.
A function that converts a custom key K
to a primitive key
KM
. This function must be deterministic and produce unique values for
unique keys.
A function that converts a primitive key KM
back to the
custom key K
. This should be the inverse of toKey
.
A new IMapMapped instance containing all entries from the iterable.
Creates a new IMapMapped instance with custom key transformation functions.
This factory function creates an immutable map that can use complex objects as keys by providing bidirectional transformation functions. The
toKey
function converts your custom key type to a primitive type that can be efficiently stored, whilefromKey
reconstructs the original key type for iteration and access.Performance: O(n) where n is the number of entries in the iterable.