EmptyWeakMap¶
@ExperimentalWeakApi
fun <K, V : Any> EmptyWeakMap(): WeakMap<K, V>
A WeakMap implementation that immediately frees its elements.
Values passed to set are never stored, so the map is always empty.
Use this implementation when testing algorithms that use a weak map, to ensure they don't rely on the value still existing.
See also¶
FakeWeakMap: Opposite behavior: values are never freed.