
com.google.protobuf.DslList.kt Maven / Gradle / Ivy
package com.google.protobuf.kotlin
/**
* A simple wrapper around a [List] with an extra generic parameter that can be used to disambiguate
* extension methods.
*
* This class is used by Kotlin protocol buffer extensions, and its constructor is public only
* because generated message code is in a different compilation unit. Others should not use this
* class directly in any way.
*/
@Suppress("unused") // the unused type parameter
class DslList @OnlyForUseByGeneratedProtoCode constructor(
private val delegate: List
) : List by delegate {
override fun iterator(): Iterator = UnmodifiableIterator(delegate.iterator())
override fun listIterator(): ListIterator = UnmodifiableListIterator(delegate.listIterator())
override fun listIterator(index: Int): ListIterator =
UnmodifiableListIterator(delegate.listIterator(index))
override fun equals(other: Any?): Boolean = delegate == other
override fun hashCode(): Int = delegate.hashCode()
override fun toString(): String = delegate.toString()
}