Repository: ktorio/ktor
File: ktor-utils/common/src/io/ktor/util/StringValues.kt (Kotlin)

Code before:
     */
    public fun isEmpty(): Boolean
}

public interface StringValuesBuilder {
    public val caseInsensitiveName: Boolean
    public fun getAll(name: String): List<String>?

    public operator fun contains(name: String): Boolean
    public fun contains(name: String, value: String): Boolean
    public fun names(): Set<String>
    public fun isEmpty(): Boolean
    public fun entries(): Set<Map.Entry<String, List<String>>>

    public operator fun set(name: String, value: String)

    public operator fun get(name: String): String?
    public fun append(name: String, value: String)
    public fun appendAll(stringValues: StringValues)
    public fun appendAll(name: String, values: Iterable<String>)

    public fun appendAll(params: Map<String, String>): Unit =
        params.forEach { (key, value) -> append(key, value) }

    public fun appendAllIterable(params: Map<String, Iterable<String>>): Unit =
        params.forEach { (key, value) -> appendAll(key, value) }

    public fun appendMissing(stringValues: StringValues)
    public fun appendMissing(name: String, values: Iterable<String>)
    public fun remove(name: String)
    public fun removeKeysWithNoEntries()
    public fun remove(name: String, value: String): Boolean
    public fun clear()

    public fun build(): StringValues
}

public open class StringValuesSingleImpl(
    override val caseInsensitiveName: Boolean,
    public val name: String,
    public val values: List<String>
) : StringValues {

    override fun getAll(name: String): List<String>? = if (this.name.equals(name, caseInsensitiveName)) values else null

    override fun entries(): Set<Map.Entry<String, List<String>>> = setOf(
        object : Map.Entry<String, List<String>> {
            override val key: String = name
            override val value: List<String> = values
            override fun toString() = "$key=$value"


Review comment (suggestion):
Let's convert these functions into extension-functions. This should allow us to rename `appendAllIterable` to `appendAll` and apply `@JvmName("appendAllIterable")` annotation to resolve name clash on JVM.

Probably we should also add extension-functions with varargs:
```kotlin
public fun StringValuesBuilder.appendAll(vararg values: Pair<String, String>) {
    values.forEach { (key, value) -> append(key, value) }
}

@JvmName("appendAllIterable")
public fun StringValuesBuilder.appendAll(vararg values: Pair<String, Iterable<String>>) {
    values.forEach { (key, value) -> appendAll(key, value) }
}
```


Code after:
     *
     * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.util.StringValues.isEmpty)
     */
    public fun isEmpty(): Boolean
}

public interface StringValuesBuilder {
    public val caseInsensitiveName: Boolean
    public fun getAll(name: String): List<String>?

    public operator fun contains(name: String): Boolean
    public fun contains(name: String, value: String): Boolean
    public fun names(): Set<String>
    public fun isEmpty(): Boolean
    public fun entries(): Set<Map.Entry<String, List<String>>>

    public operator fun set(name: String, value: String)

    public operator fun get(name: String): String?
    public fun append(name: String, value: String)
    public fun appendAll(stringValues: StringValues)
    public fun appendAll(name: String, values: Iterable<String>)
    public fun appendMissing(stringValues: StringValues)
    public fun appendMissing(name: String, values: Iterable<String>)
    public fun remove(name: String)
    public fun removeKeysWithNoEntries()
    public fun remove(name: String, value: String): Boolean
    public fun clear()

    public fun build(): StringValues
}

public open class StringValuesSingleImpl(
    override val caseInsensitiveName: Boolean,
    public val name: String,
    public val values: List<String>
) : StringValues {

    override fun getAll(name: String): List<String>? = if (this.name.equals(name, caseInsensitiveName)) values else null

    override fun entries(): Set<Map.Entry<String, List<String>>> = setOf(
        object : Map.Entry<String, List<String>> {
            override val key: String = name
            override val value: List<String> = values
            override fun toString() = "$key=$value"

            override fun equals(other: Any?): Boolean =
                other is Map.Entry<*, *> &&
                    other.key == key &&
                    other.value == value