moved runnable{ ...} to the kotlin package where it belongs as it makes a standard java.lang functional interface
This commit is contained in:
@@ -69,3 +69,14 @@ public inline fun <T> Iterator<T>.toTreeSet() : TreeSet<T> = to(TreeSet<T>())
|
|||||||
Run function f
|
Run function f
|
||||||
*/
|
*/
|
||||||
public inline fun <T> run(f: () -> T) : T = f()
|
public inline fun <T> run(f: () -> T) : T = f()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A helper method for creating a [[Runnable]] from a function
|
||||||
|
*/
|
||||||
|
public inline fun runnable(action: ()-> Unit): Runnable {
|
||||||
|
return object: Runnable {
|
||||||
|
public override fun run() {
|
||||||
|
action()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,13 +50,3 @@ public inline fun Executor.execute(action: ()->Unit) {
|
|||||||
execute(runnable(action))
|
execute(runnable(action))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A helper method for creating a [[Runnable]] from a block
|
|
||||||
*/
|
|
||||||
public inline fun runnable(action: ()-> Unit): Runnable {
|
|
||||||
return object: Runnable {
|
|
||||||
public override fun run() {
|
|
||||||
action()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user