Provide Lazy<T> in kotlin package — an interface that represents lazily computed value. Read-only properties can be delegated to lazy with the extension getter. Delegates.lazy and blockingLazy are deprecated.

This commit is contained in:
Ilya Gorbunov
2015-06-11 23:29:33 +03:00
parent f2788d53c0
commit 536e669023
5 changed files with 203 additions and 62 deletions
+5 -1
View File
@@ -49,4 +49,8 @@ public fun setOf<T>(value: T): Set<T> = hashSetOf(value)
* Returns an immutable map, mapping only the specified key to the
* specified value.
*/
public fun mapOf<K, V>(keyValuePair: Pair<K, V>): Map<K, V> = hashMapOf(keyValuePair)
public fun mapOf<K, V>(keyValuePair: Pair<K, V>): Map<K, V> = hashMapOf(keyValuePair)
public fun lazy<T>(initializer: () -> T): Lazy<T> = UnsafeLazyImpl(initializer)
public fun lazy<T>(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy<T> = UnsafeLazyImpl(initializer)