mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 08:31:29 +00:00
32 lines
1.1 KiB
Kotlin
Vendored
32 lines
1.1 KiB
Kotlin
Vendored
// IGNORE_BACKEND: JVM_IR
|
|
interface ImmutableCollection<out E> : Collection<E> {
|
|
fun add(element: @UnsafeVariance E): ImmutableCollection<E>
|
|
fun addAll(elements: Collection<@UnsafeVariance E>): ImmutableCollection<E>
|
|
fun remove(element: @UnsafeVariance E): ImmutableCollection<E>
|
|
}
|
|
|
|
class ImmutableCollectionmpl<E> : ImmutableCollection<E> {
|
|
override val size: Int
|
|
get() = throw UnsupportedOperationException()
|
|
|
|
override fun contains(element: E): Boolean {
|
|
throw UnsupportedOperationException("not implemented")
|
|
}
|
|
|
|
override fun containsAll(elements: Collection<E>): Boolean {
|
|
throw UnsupportedOperationException("not implemented")
|
|
}
|
|
|
|
override fun isEmpty(): Boolean {
|
|
throw UnsupportedOperationException("not implemented")
|
|
}
|
|
|
|
override fun iterator(): Iterator<E> {
|
|
throw UnsupportedOperationException("not implemented")
|
|
}
|
|
|
|
override fun add(element: E): ImmutableCollection<E> = this
|
|
override fun addAll(elements: Collection<E>): ImmutableCollection<E> = this
|
|
override fun remove(element: E): ImmutableCollection<E> = this
|
|
}
|