kotlin.collections.SetsJVM.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-stdlib Show documentation
Show all versions of kotlin-stdlib Show documentation
Kotlin Standard Library for JVM
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("SetsKt")
package kotlin.collections
/**
* Returns an immutable set containing only the specified object [element].
* The returned set is serializable.
*/
public fun setOf(element: T): Set = java.util.Collections.singleton(element)
/**
* Returns a new [java.util.SortedSet] with the given elements.
*/
public fun sortedSetOf(vararg elements: T): java.util.TreeSet = elements.toCollection(java.util.TreeSet())
/**
* Returns a new [java.util.SortedSet] with the given [comparator] and elements.
*/
public fun sortedSetOf(comparator: Comparator, vararg elements: T): java.util.TreeSet = elements.toCollection(java.util.TreeSet(comparator))