examples converted to new syntax

This commit is contained in:
Alex Tkachman
2011-12-22 14:50:21 +02:00
parent 6d41dee6f7
commit b0b14ecaa2
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -30,8 +30,8 @@ class StandardFList<T> (override val head: T, override val tail: FList<T>) : FLi
fun <T> FList<T>.plus2(element: T): FList<T> =
when(this) {
is EmptyFList<*> => OneElementFList<T>(element)
else => StandardFList<T>(element, this)
is EmptyFList<*> -> OneElementFList<T>(element)
else -> StandardFList<T>(element, this)
}
fun <T> FList<T>.plus3(element: T) : FList<T> =
+1 -1
View File
@@ -8,7 +8,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.ReentrantLock;
fun <T> Int.latch(op: fun CountDownLatch.() : T) : T {
fun <T> Int.latch(op: CountDownLatch.() -> T) : T {
val cdl = CountDownLatch(this)
val res = cdl.op()
cdl.await()