Migrate type parameter list syntax.
This commit is contained in:
@@ -24,19 +24,19 @@ internal object EmptySet : Set<Nothing>, Serializable {
|
||||
|
||||
|
||||
/** Returns an empty read-only set. The returned set is serializable (JVM). */
|
||||
public fun emptySet<T>(): Set<T> = EmptySet
|
||||
public fun <T> emptySet(): Set<T> = EmptySet
|
||||
/** Returns a new read-only ordered set with the given elements. The returned set is serializable (JVM). */
|
||||
public fun setOf<T>(vararg values: T): Set<T> = if (values.size > 0) values.toSet() else emptySet()
|
||||
public fun <T> setOf(vararg values: T): Set<T> = if (values.size > 0) values.toSet() else emptySet()
|
||||
|
||||
/** Returns an empty read-only set. The returned set is serializable (JVM). */
|
||||
public fun setOf<T>(): Set<T> = emptySet()
|
||||
public fun <T> setOf(): Set<T> = emptySet()
|
||||
|
||||
|
||||
/** Returns a new [HashSet] with the given elements. */
|
||||
public fun hashSetOf<T>(vararg values: T): HashSet<T> = values.toCollection(HashSet(mapCapacity(values.size)))
|
||||
public fun <T> hashSetOf(vararg values: T): HashSet<T> = values.toCollection(HashSet(mapCapacity(values.size)))
|
||||
|
||||
/** Returns a new [LinkedHashSet] with the given elements. */
|
||||
public fun linkedSetOf<T>(vararg values: T): LinkedHashSet<T> = values.toCollection(LinkedHashSet(mapCapacity(values.size)))
|
||||
public fun <T> linkedSetOf(vararg values: T): LinkedHashSet<T> = values.toCollection(LinkedHashSet(mapCapacity(values.size)))
|
||||
|
||||
/** Returns this Set if it's not `null` and the empty set otherwise. */
|
||||
public fun <T> Set<T>?.orEmpty(): Set<T> = this ?: emptySet()
|
||||
@@ -46,17 +46,17 @@ public fun <T> Set<T>?.orEmpty(): Set<T> = this ?: emptySet()
|
||||
* The returned set is serializable.
|
||||
*/
|
||||
@JvmVersion
|
||||
public fun setOf<T>(value: T): Set<T> = Collections.singleton(value)
|
||||
public fun <T> setOf(value: T): Set<T> = Collections.singleton(value)
|
||||
|
||||
|
||||
/**
|
||||
* Returns a new [SortedSet] with the given elements.
|
||||
*/
|
||||
@JvmVersion
|
||||
public fun sortedSetOf<T>(vararg values: T): TreeSet<T> = values.toCollection(TreeSet<T>())
|
||||
public fun <T> sortedSetOf(vararg values: T): TreeSet<T> = values.toCollection(TreeSet<T>())
|
||||
|
||||
/**
|
||||
* Returns a new [SortedSet] with the given [comparator] and elements.
|
||||
*/
|
||||
@JvmVersion
|
||||
public fun sortedSetOf<T>(comparator: Comparator<in T>, vararg values: T): TreeSet<T> = values.toCollection(TreeSet<T>(comparator))
|
||||
public fun <T> sortedSetOf(comparator: Comparator<in T>, vararg values: T): TreeSet<T> = values.toCollection(TreeSet<T>(comparator))
|
||||
|
||||
@@ -22,7 +22,7 @@ public abstract class Lazy<out T> internal constructor() {
|
||||
/**
|
||||
* Creates a new instance of the [Lazy] that is already initialized with the specified [value].
|
||||
*/
|
||||
public fun lazyOf<T>(value: T): Lazy<T> = InitializedLazyImpl(value)
|
||||
public fun <T> lazyOf(value: T): Lazy<T> = InitializedLazyImpl(value)
|
||||
|
||||
/**
|
||||
* Creates a new instance of the [Lazy] that uses the specified initialization function [initializer]
|
||||
@@ -34,7 +34,7 @@ public fun lazyOf<T>(value: T): Lazy<T> = InitializedLazyImpl(value)
|
||||
* the returned instance as it may cause accidental deadlock. Also this behavior can be changed in the future.
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
public fun lazy<T>(initializer: () -> T): Lazy<T> = SynchronizedLazyImpl(initializer)
|
||||
public fun <T> lazy(initializer: () -> T): Lazy<T> = SynchronizedLazyImpl(initializer)
|
||||
|
||||
/**
|
||||
* Creates a new instance of the [Lazy] that uses the specified initialization function [initializer]
|
||||
@@ -47,7 +47,7 @@ public fun lazy<T>(initializer: () -> T): Lazy<T> = SynchronizedLazyImpl(initial
|
||||
* Also this behavior can be changed in the future.
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
public fun lazy<T>(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T> =
|
||||
public fun <T> lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T> =
|
||||
when (mode) {
|
||||
LazyThreadSafetyMode.SYNCHRONIZED -> SynchronizedLazyImpl(initializer)
|
||||
LazyThreadSafetyMode.PUBLICATION -> SafePublicationLazyImpl(initializer)
|
||||
@@ -66,7 +66,7 @@ public fun lazy<T>(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T> =
|
||||
* Also this behavior can be changed in the future.
|
||||
*/
|
||||
@kotlin.jvm.JvmVersion
|
||||
public fun lazy<T>(lock: Any?, initializer: () -> T): Lazy<T> = SynchronizedLazyImpl(initializer, lock)
|
||||
public fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T> = SynchronizedLazyImpl(initializer, lock)
|
||||
|
||||
/**
|
||||
* An extension to delegate a read-only property of type [T] to an instance of [Lazy].
|
||||
|
||||
Reference in New Issue
Block a user