Final moves: map delegating accessors and timing utils
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
@file:kotlin.jvm.JvmName("MapAccessorsKt")
|
||||
package kotlin.properties
|
||||
package kotlin.collections
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
import kotlin.internal.Exact
|
||||
@@ -44,7 +44,7 @@ public object Delegates {
|
||||
* as a key.
|
||||
* @param map the map where the property values are stored.
|
||||
*/
|
||||
@Deprecated("Delegate property to the map itself without creating a wrapper.", ReplaceWith("map", "kotlin.properties.get", "kotlin.properties.set"))
|
||||
@Deprecated("Delegate property to the map itself without creating a wrapper.", ReplaceWith("map"))
|
||||
public fun <T> mapVar(map: MutableMap<in String, Any?>): ReadWriteProperty<Any?, T> {
|
||||
return FixedMapVar<Any?, String, T>(map, propertyNameSelector, throwKeyNotFound)
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public object Delegates {
|
||||
* as a key.
|
||||
* @param map the map where the property values are stored.
|
||||
*/
|
||||
@Deprecated("Delegate property to the map itself without creating a wrapper.", ReplaceWith("map", "kotlin.properties.get"))
|
||||
@Deprecated("Delegate property to the map itself without creating a wrapper.", ReplaceWith("map"))
|
||||
public fun <T> mapVal(map: Map<in String, Any?>): ReadOnlyProperty<Any?, T> {
|
||||
return FixedMapVal<Any?, String, T>(map, propertyNameSelector, throwKeyNotFound)
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
@file:kotlin.jvm.JvmName("TimingUtilsKt")
|
||||
package kotlin.util
|
||||
@file:kotlin.jvm.JvmName("TimingKt")
|
||||
package kotlin.system
|
||||
|
||||
/**
|
||||
* Executes the given block and returns elapsed time in milliseconds.
|
||||
*/
|
||||
public fun measureTimeMillis(block: () -> Unit) : Long {
|
||||
public inline fun measureTimeMillis(block: () -> Unit) : Long {
|
||||
val start = System.currentTimeMillis()
|
||||
block()
|
||||
return System.currentTimeMillis() - start
|
||||
@@ -13,7 +13,7 @@ public fun measureTimeMillis(block: () -> Unit) : Long {
|
||||
/**
|
||||
* Executes the given block and returns elapsed time in nanoseconds.
|
||||
*/
|
||||
public fun measureTimeNano(block: () -> Unit) : Long {
|
||||
public inline fun measureTimeNano(block: () -> Unit) : Long {
|
||||
val start = System.nanoTime()
|
||||
block()
|
||||
return System.nanoTime() - start
|
||||
Reference in New Issue
Block a user