Type aliases
|
typealias NodeSet = Set<Network.Node>
typealias FileTable<K> = MutableMap<K, MutableList<File>>
|
typealias NodeSet = Set<Network.Node>
typealias FileTable<K> = Dictionary<K, Array<File>>
|
typealias MyHandler = (Int, String, Any) -> Unit
typealias Predicate<T> = (T) -> Boolean
|
typealias MyHandler = (Int, String, Any) -> Void
typealias Predicate<T> = (T) -> Bool
|
class A {
inner class Inner
}
class B {
inner class Inner
}
typealias AInner = A.Inner
typealias BInner = B.Inner
|
class A {
class Inner {}
}
class B {
class Inner {}
}
typealias AInner = A.Inner
typealias BInner = B.Inner
|
typealias Predicate<T> = (T) -> Boolean
fun foo(p: Predicate<Int>) = p(42)
fun main() {
val f: (Int) -> Boolean = { it > 0 }
println(foo(f)) // prints "true"
val p: Predicate<Int> = { it > 0 }
println(listOf(1, -2).filter(p)) // prints "[1]"
}
|
typealias Predicate<T> = (T) -> Bool
func foo(p: Predicate<Int>) -> Bool {
p(42)
}
let f: (Int) -> Bool = { $0 > 0 }
print(foo(p: f)) // prints "true"
let p: Predicate<Int> = { $0 > 0 }
print([1, -2].filter(p)) // prints "[1]"
|