> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kotlin Import Alias

Kotlin provides an import aliasing mechanism via the `as` keyword, allowing developers to locally bind a new identifier to a fully qualified class, function, property, or object at the point of import. This creates a file-scoped alternative identifier for the imported declaration without altering the original source code.

## Syntax

The aliasing syntax appends the `as` keyword followed by the desired local identifier to a standard import directive:

```kotlin theme={"dark"}
import package.name.OriginalIdentifier as LocalAlias
```

## Technical Mechanics

* **Lexical Scoping:** An import alias is strictly confined to the file in which it is declared. It does not pollute the global namespace or affect how the target declaration is referenced in other files within the same module.
* **Compiler Resolution:** The alias is a purely syntactic construct handled during the compiler's import resolution phase. The Kotlin compiler maps the `LocalAlias` directly to the `OriginalIdentifier`'s fully qualified name. It does not generate wrapper classes or incur runtime overhead.
* **Applicability:** The `as` keyword can be applied to any importable symbol. This includes:
  * Classes and Interfaces
  * Top-level functions
  * Top-level properties
  * Object declarations
  * Enum constants

## Code Examples

**Aliasing Classes**

```kotlin theme={"dark"}
import java.util.Date as UtilDate
import java.sql.Date as SqlDate

// The aliases are instantiated directly as if they were the original class names
val currentUtilDate: UtilDate = UtilDate()
val currentSqlDate: SqlDate = SqlDate(System.currentTimeMillis())
```

**Aliasing Top-Level Functions**

```kotlin theme={"dark"}
import kotlin.math.max as findMaximum

// The function is invoked using the local alias
val result = findMaximum(10, 20)
```

## Distinction from `typealias`

It is critical to distinguish an import alias (`import ... as`) from a type alias (`typealias`):

| Characteristic           | `import ... as`                                                | `typealias`                                                       |
| :----------------------- | :------------------------------------------------------------- | :---------------------------------------------------------------- |
| **Scope**                | File-level only.                                               | Package, module, or public scope (based on visibility modifiers). |
| **Target**               | Any importable symbol (Types, Functions, Properties, Objects). | Types only (Classes, Interfaces, Function Types).                 |
| **Declaration Location** | File header, alongside standard imports.                       | Top-level declaration within a file.                              |
| **Reusability**          | Cannot be referenced outside the declaring file.               | Can be imported and used by other files/modules.                  |

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Kotlin Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
