Type Aliases
Introducing type aliases, including generic variants, what they are and what they aren’t, and how a simple type alias can have a profound influence on how readable your code is.
— — — — — — — — — — — — — — —
THE CURRENT VERSION OF THIS ARTICLE IS PUBLISHED HERE.
— — — — — — — — — — — — — — —
Tags: #KOTLIN FEATURE
This article is part of the Kotlin Primer, an opinionated guide to the Kotlin language, which is indented to help facilitate Kotlin adoption inside Java-centric organizations. It was originally written as an organizational learning resource for Etnetera a.s. and I would like to express my sincere gratitude for their support.
It is recommended to read the Introduction before moving on. Check out the Table of Contents for all articles.
Kotlin allows you to define type aliases, which are simply placeholders for other types.. These can be useful to shorten long verbose types into something more manageable, as well as giving meaning to nonspecific types. Pair<Long, Int>
could be OnlineUserCountAtInstant
, for example.