@@ -14,26 +14,60 @@ inline fun <K, V> ImmutableMap<K, V>.mutate(mutator: (MutableMap<K, V>) -> Unit)
14
14
inline operator fun <E > ImmutableCollection<E>.plus (element : E ): ImmutableCollection <E > = add(element)
15
15
inline operator fun <E > ImmutableCollection<E>.minus (element : E ): ImmutableCollection <E > = remove(element)
16
16
17
+
18
+ operator fun <E > ImmutableCollection<E>.plus (elements : Iterable <E >): ImmutableCollection <E >
19
+ = if (elements is Collection ) addAll(elements) else builder().also { it.addAll(elements) }.build()
20
+ operator fun <E > ImmutableCollection<E>.plus (elements : Array <out E >): ImmutableCollection <E >
21
+ = builder().also { it.addAll(elements) }.build()
22
+ operator fun <E > ImmutableCollection<E>.plus (elements : Sequence <E >): ImmutableCollection <E >
23
+ = builder().also { it.addAll(elements) }.build()
24
+
25
+
26
+ operator fun <E > ImmutableCollection<E>.minus (elements : Iterable <E >): ImmutableCollection <E >
27
+ = if (elements is Collection ) removeAll(elements) else builder().also { it.removeAll(elements) }.build()
28
+ operator fun <E > ImmutableCollection<E>.minus (elements : Array <out E >): ImmutableCollection <E >
29
+ = builder().also { it.removeAll(elements) }.build()
30
+ operator fun <E > ImmutableCollection<E>.minus (elements : Sequence <E >): ImmutableCollection <E >
31
+ = builder().also { it.removeAll(elements) }.build()
32
+
33
+
17
34
inline operator fun <E > ImmutableList<E>.plus (element : E ): ImmutableList <E > = add(element)
18
35
inline operator fun <E > ImmutableList<E>.minus (element : E ): ImmutableList <E > = remove(element)
19
36
20
37
21
38
operator fun <E > ImmutableList<E>.plus (elements : Iterable <E >): ImmutableList <E >
22
39
= if (elements is Collection ) addAll(elements) else mutate { it.addAll(elements) }
40
+ operator fun <E > ImmutableList<E>.plus (elements : Array <out E >): ImmutableList <E >
41
+ = mutate { it.addAll(elements) }
42
+ operator fun <E > ImmutableList<E>.plus (elements : Sequence <E >): ImmutableList <E >
43
+ = mutate { it.addAll(elements) }
44
+
23
45
24
46
operator fun <E > ImmutableList<E>.minus (elements : Iterable <E >): ImmutableList <E >
25
47
= if (elements is Collection ) removeAll(elements) else mutate { it.removeAll(elements) }
48
+ operator fun <E > ImmutableList<E>.minus (elements : Array <out E >): ImmutableList <E >
49
+ = mutate { it.removeAll(elements) }
50
+ operator fun <E > ImmutableList<E>.minus (elements : Sequence <E >): ImmutableList <E >
51
+ = mutate { it.removeAll(elements) }
26
52
27
53
28
54
inline operator fun <E > ImmutableSet<E>.plus (element : E ): ImmutableSet <E > = add(element)
29
55
inline operator fun <E > ImmutableSet<E>.minus (element : E ): ImmutableSet <E > = remove(element)
30
56
31
-
32
57
operator fun <E > ImmutableSet<E>.plus (elements : Iterable <E >): ImmutableSet <E >
33
58
= if (elements is Collection ) addAll(elements) else mutate { it.addAll(elements) }
59
+ operator fun <E > ImmutableSet<E>.plus (elements : Array <out E >): ImmutableSet <E >
60
+ = mutate { it.addAll(elements) }
61
+ operator fun <E > ImmutableSet<E>.plus (elements : Sequence <E >): ImmutableSet <E >
62
+ = mutate { it.addAll(elements) }
63
+
34
64
35
65
operator fun <E > ImmutableSet<E>.minus (elements : Iterable <E >): ImmutableSet <E >
36
66
= if (elements is Collection ) removeAll(elements) else mutate { it.removeAll(elements) }
67
+ operator fun <E > ImmutableSet<E>.minus (elements : Array <out E >): ImmutableSet <E >
68
+ = mutate { it.removeAll(elements) }
69
+ operator fun <E > ImmutableSet<E>.minus (elements : Sequence <E >): ImmutableSet <E >
70
+ = mutate { it.removeAll(elements) }
37
71
38
72
39
73
inline operator fun <K , V > ImmutableMap <out K , V >.plus (pair : Pair <K , V >): ImmutableMap <K , V >
0 commit comments