Type aliases

Other topics

Remarks:

Type aliases is a feature of the compiler. Nothing is added in the generated code for the JVM. All aliases will be replaced by the real type.

Function type

typealias StringValidator = (String) -> Boolean
typealias Reductor<T, U, V> = (T, U) -> V

Generic type

typealias Parents = Pair<Person, Person>
typealias Accounts = List<Account>

Syntax:

  • typealias alias-name = existing-type

Contributors

Topic Id: 9453

Example Ids: 29275,29276

This site is not affiliated with any of the contributors.