> ## 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 Data Object

A `data object` in Kotlin is a singleton declaration that instructs the compiler to automatically generate `toString()`, `equals()`, and `hashCode()` functions based on the object's name and type. Introduced in Kotlin 1.9.0, it provides the structural symmetry of a `data class` while maintaining the single-instance guarantee of a standard `object`.

```kotlin theme={"dark"}
data object ConfigurationState
```

## Compiler-Generated Functions

When you declare a `data object`, the Kotlin compiler synthesizes three specific member functions:

1. **`toString()`**: Returns the exact literal name of the object as a `String`.
2. **`equals(other: Any?)`**: Returns `true` if the `other` reference is an instance of the exact same `data object` type.
3. **`hashCode()`**: Returns a consistent, pre-calculated integer hash specific to the singleton's type, ensuring stable behavior in hash-based collections.

## Behavioral Differences from Standard Objects

A standard `object` relies on the default `Any` implementation for its string representation, which appends the object's memory address hash. A `data object` overrides this to return its clean identifier.

```kotlin theme={"dark"}
object StandardSingleton
data object DataSingleton

fun main() {
    println(StandardSingleton) // Output: StandardSingleton@5a07e868
    println(DataSingleton)     // Output: DataSingleton
}
```

## Omitted Data Class Functions

Unlike a `data class`, a `data object` does **not** generate the following functions:

* **`copy()`**: Omitted because singletons inherently forbid the creation of cloned or mutated instances. The type system enforces that only one instance of the object exists in the JVM.
* **`componentN()`**: Omitted because a `data object` lacks a primary constructor and therefore has no properties to destructure.

## Inheritance Rules

A `data object` adheres to the exact same inheritance rules as a standard `object`. It can extend open or abstract classes and implement interfaces.

```kotlin theme={"dark"}
interface State
abstract class BaseEvent

data object Idle : State
data object Initialized : BaseEvent()
```

## Equality Semantics

Because a `data object` is a singleton, referential equality (`===`) and structural equality (`==`) will always yield the same result when comparing it against itself. However, the generated `equals()` method ensures that if the `data object` is serialized and deserialized (or instantiated via reflection in edge cases), structural equality remains intact based on the type rather than the memory reference.

<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>
