https://kotlinlang.org logo
#stdlib
Title
# stdlib
d

Dave Leeds

04/19/2018, 3:14 AM
Hello! I'm doing some research on type aliases, so I'm looking through the standard library to see how
typealias
is used. I've found that it's most frequently used to map some common classes (e.g., exceptions,
StringBuilder
,
ArrayList
,
Serializable
) to the corresponding Java classes. I was curious if @ilya.gorbunov or someone else at JB can fill me in on the purpose of these particular aliases in the standard library. Are they intended to save on imports (e.g., no need to import
java.util.*
if
ArrayList
is found in
kotlin.collections
)? Or to give Kotlin the flexibility to expand on the interface of those classes in the future? Or something else? Thanks!
g

gildor

04/19/2018, 3:15 AM
Those typealiases created for multiplatform projects Not all of them currently available for multiplatofrm, but many of them (exceptions,
StringBuilder
,
ArrayList
, but not Serializable)
d

Dave Leeds

04/19/2018, 3:19 AM
Okay, gotcha... So, in the case of the JVM, it's just a type alias, but in the case of JS, there's an implementation of each... yes?
👌 1
g

gildor

04/19/2018, 3:21 AM
yes
d

Dave Leeds

04/19/2018, 3:22 AM
Thanks!
g

gildor

04/19/2018, 3:22 AM
Also some APIs are still JVM only, but already part of Kotlin stdlib, maybe for future usage
👍 1