Skip to content

Commit fa8229f

Browse files
markiewiczartArtur Markiewicz
authored andcommitted
Typos fixed
1 parent f811ceb commit fa8229f

File tree

2 files changed

+10
-5
lines changed
  • Inline/Inline Classes

2 files changed

+10
-5
lines changed

Inline/Inline Classes/Inline classes vs Type Aliases/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Inline Classes vs Type Aliases
22

3-
Both, tools introduce a new type and represent the underlying type.
3+
Both tools introduce a new type and represent the underlying type.
44
Hence, both may be treated as a wrapper.
55

66
## Recap Type Alias

Inline/Inline Classes/Introduction/task.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,22 @@ They are a subset of value-based classes like the primitives Int, Long, etc.
66
Inline classes behave differently compared to regular classes.
77
They are represented both as the underlying values type and as a wrapper.
88
Hence, they do not have a stable identity.
9-
Therefor, reference equality ( === ) is not provided.
9+
Therefore, reference equality ( === ) is not provided.
1010

11-
## Exmaple: Int
11+
## Example: Int
1212

13-
The kotlin Int class may be represented as the primitive **int** in the JVM platform or as the boxed Integer class.
13+
The Kotlin Int class may be represented as the primitive **int** in the JVM platform or as the boxed Integer class.
1414

1515
Inline classes are a tool to allow developers to define value-based classes to provide this behavior.
1616

1717
## Declaration
1818

19-
To declare an inline class the *value* keyword is used. In addition, the **JvmInline** annotation must be annotated.
19+
To declare an inline class the *value* keyword is used. In addition, the `@JvmInline` annotation must be added:
20+
21+
```kotlin
22+
@JvmInline
23+
value class PositiveId(private val value: Long)
24+
```
2025

2126
The inline classes force to initialize a single property in the primary constructor.
2227
Not more, not less.

0 commit comments

Comments
 (0)