linkedSetOf

fun <T> linkedSetOf(vararg elements: T): LinkedHashSet<T>(source)

Returns a new LinkedHashSet with the given elements. Elements of the set are iterated in the order they were specified.

Since Kotlin

1.0

Samples

import kotlin.test.*

fun main() { 
   //sampleStart 
   val set: LinkedHashSet<Int> = linkedSetOf(1, 3, 2)

println(set) // [1, 3, 2]

set.remove(3)
set += listOf(5, 4)
println(set) // [1, 2, 5, 4] 
   //sampleEnd
}