Kotlin - Statement Import renaming

Introduction

If two different packages use the same name, you can use the as keyword to alias their name.

This is useful when common names are used by multiple libraries:


import com.java2s.myproject.Foo 
import com.java2s.otherproject.Foo as Foo2 

fun doubleFoo() { 
          val foo1 = Foo() 
          val foo2 = Foo2() 
} 

Related Topic