does this ```typealias Visitor<T> = (TreeNod...
# getting-started
o
does this
Copy code
typealias Visitor<T> = (TreeNode<T>) -> Unit
mean, “any function that takes TreeNode<T> and return Unit can now be referred to as
Visitor<T>
? so instead of writing
Copy code
fun search(printResult: (TreeNode<T>) -> Unit)
I write
fun search(visit: Visitor<T>)
d
Yes and the compiler will replace the Visitor<T> with the correct type. It doesn’t create a new type just a simpler short hand for your code. https://kotlinlang.org/docs/type-aliases.html
You’d be able to write both ways