is there an `import as` in kotlin? I need to use t...
# getting-started
o
is there an
import as
in kotlin? I need to use two classes that are called the same but different packages and I dont want my entire package name behind each usage of one or the other to differentiate
yes black 4
yup there is, literally just import …… as …
s
Copy code
import org.test.Message as testMessage
https://kotlinlang.org/docs/packages.html#imports
v
Please:
Copy code
import org.test.Message as TestMessage
🙂
1
b
and if you don't want to replicate the same
import as
renamings in each source file, you can take a look at typealiases: https://kotlinlang.org/docs/type-aliases.html
s
the lowercase
testMessage
is from the official docs 🤷‍♂️ Personally I'd use uppercase as well.
🤯 1