lazyOf to create already initialized lazy value.

This commit is contained in:
Ilya Gorbunov
2015-06-18 20:21:40 +03:00
parent b71fe4cd25
commit 346ea28337
4 changed files with 20 additions and 11 deletions
+8 -1
View File
@@ -51,6 +51,13 @@ public fun setOf<T>(value: T): Set<T> = hashSetOf(value)
*/
public fun mapOf<K, V>(keyValuePair: Pair<K, V>): Map<K, V> = hashMapOf(keyValuePair)
/**
* Creates a new instance of the [Lazy] that uses the specified initialization function [initializer].
*/
public fun lazy<T>(initializer: () -> T): Lazy<T> = UnsafeLazyImpl(initializer)
/**
* Creates a new instance of the [Lazy] that uses the specified initialization function [initializer].
*
* The [mode] parameter is ignored. */
public fun lazy<T>(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T> = UnsafeLazyImpl(initializer)