IdentityWeakKeyArrayMap
A pure-Kotlin common WeakMap implementation using WeakRef.
Keys are compared by identity.
This implementation is ideal when storing mappings from large complex objects to other large objects.
Performance characteristics
Elements are stored in an ArrayList. On each operation, elements are scanned linearly until the element on which the operation is requested is found. Expired elements are freed when they are visited. This implies that all operations are in O(n)
.
Additionally, older elements are visited more often, so they are more likely to be freed early.