@@ -30,8 +30,10 @@ If the order of elements doesn't matter, more efficient `immutableHashSetOf` and
30
30
Converts a read-only or mutable collection to an immutable one.
31
31
If the receiver is already immutable and has the required type, returns itself.
32
32
33
- fun Iterable<T>.toImmutableList(): ImmutableList<T>
34
- fun Iterable<T>.toImmutableSet(): ImmutableSet<T>
33
+ ``` kotlin
34
+ fun Iterable<T>.toImmutableList (): ImmutableList <T >
35
+ fun Iterable<T>.toImmutableSet (): ImmutableSet <T >
36
+ ```
35
37
36
38
#### ` + ` and ` - ` operators
37
39
@@ -49,7 +51,7 @@ val newList = immutableListOf("a", "b") + "c"
49
51
in order for them to take the precedence over the ones from the
50
52
standard library.
51
53
52
- ```
54
+ ``` kotlin
53
55
import kotlinx.collections.immutable.*
54
56
```
55
57
@@ -58,11 +60,15 @@ import kotlinx.collections.immutable.*
58
60
` mutate ` extension function simplifies quite common pattern of immutable collection modification:
59
61
get a builder, apply some mutating operations on it, transform it back to an immutable collection:
60
62
61
- collection.builder().apply { some_actions_on(this) }.build()
63
+ ``` kotlin
64
+ collection.builder().apply { some_actions_on(this ) }.build()
65
+ ```
62
66
63
67
With ` mutate ` it transforms to:
64
68
65
- collection.mutate { some_actions_on(it) }
69
+ ``` kotlin
70
+ collection.mutate { some_actions_on(it) }
71
+ ```
66
72
67
73
## Using in your projects
68
74
0 commit comments