commonMain.implementations.immutableMap.PersistentHashMapContentViews.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlinx-collections-immutable Show documentation
Show all versions of kotlinx-collections-immutable Show documentation
Kotlin Immutable Collections multiplatform library
The newest version!
/*
* Copyright 2016-2019 JetBrains s.r.o.
* Use of this source code is governed by the Apache 2.0 License that can be found in the LICENSE.txt file.
*/
package kotlinx.collections.immutable.implementations.immutableMap
import kotlinx.collections.immutable.ImmutableCollection
import kotlinx.collections.immutable.ImmutableSet
import kotlinx.collections.immutable.internal.MapImplementation
internal class PersistentHashMapEntries(private val map: PersistentHashMap) : ImmutableSet>, AbstractSet>() {
override val size: Int get() = map.size
override fun contains(element: Map.Entry): Boolean {
return MapImplementation.containsEntry(map, element)
}
override fun iterator(): Iterator> {
return PersistentHashMapEntriesIterator(map.node)
}
}
internal class PersistentHashMapKeys(private val map: PersistentHashMap) : ImmutableSet, AbstractSet() {
override val size: Int
get() = map.size
override fun contains(element: K): Boolean {
return map.containsKey(element)
}
override fun iterator(): Iterator {
return PersistentHashMapKeysIterator(map.node)
}
}
internal class PersistentHashMapValues(private val map: PersistentHashMap) : ImmutableCollection, AbstractCollection() {
override val size: Int
get() = map.size
override fun contains(element: V): Boolean {
return map.containsValue(element)
}
override fun iterator(): Iterator {
return PersistentHashMapValuesIterator(map.node)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy