interface ImmutableCollection : Collection { fun add(element: @UnsafeVariance E): ImmutableCollection fun addAll(elements: Collection<@UnsafeVariance E>): ImmutableCollection fun remove(element: @UnsafeVariance E): ImmutableCollection } class ImmutableCollectionmpl : ImmutableCollection { override val size: Int get() = throw UnsupportedOperationException() override fun contains(element: E): Boolean { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. } override fun containsAll(elements: Collection): Boolean { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. } override fun isEmpty(): Boolean { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. } override fun iterator(): Iterator { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. } override fun add(element: E): ImmutableCollection = this override fun addAll(elements: Collection): ImmutableCollection = this override fun remove(element: E): ImmutableCollection = this }