commonMain.co.touchlab.stately.collections.IsoMutableCollection.kt Maven / Gradle / Ivy
package co.touchlab.stately.collections
import co.touchlab.stately.isolate.IsolateState
import co.touchlab.stately.isolate.StateHolder
import co.touchlab.stately.isolate.StateRunner
import co.touchlab.stately.isolate.createState
open class IsoMutableCollection internal constructor(stateHolder: StateHolder>) :
IsolateState>(stateHolder), MutableCollection {
constructor(stateRunner: StateRunner? = null, producer: () -> MutableCollection) : this(createState(stateRunner, producer))
override fun equals(other: Any?): Boolean {
return access { it == other }
}
override fun hashCode(): Int {
return access { it.hashCode() }
}
override val size: Int
get() = access { it.size }
override fun contains(element: T): Boolean = access { it.contains(element) }
override fun containsAll(elements: Collection): Boolean = access { it.containsAll(elements) }
override fun isEmpty(): Boolean = access { it.isEmpty() }
override fun add(element: T): Boolean = access { it.add(element) }
override fun addAll(elements: Collection): Boolean = access { it.addAll(elements) }
override fun clear() = access { it.clear() }
override fun iterator(): MutableIterator = access { IsoMutableIterator(fork(it.iterator())) }
override fun remove(element: T): Boolean = access { it.remove(element) }
override fun removeAll(elements: Collection): Boolean = access { it.removeAll(elements) }
override fun retainAll(elements: Collection): Boolean = access { it.retainAll(elements) }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy