moved runnable{ ...} to the kotlin package where it belongs as it makes a standard java.lang functional interface

This commit is contained in:
James Strachan
2012-04-11 10:52:39 +01:00
parent 7f5631bcfc
commit c79996183c
2 changed files with 11 additions and 10 deletions
+11
View File
@@ -69,3 +69,14 @@ public inline fun <T> Iterator<T>.toTreeSet() : TreeSet<T> = to(TreeSet<T>())
Run function 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))
}
/**
* 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()
}
}
}