@@ -31,120 +31,154 @@ import io.vavr.collection.Stream
31
31
*/
32
32
33
33
/* *
34
+ * Creates a [List] of the given elements.
35
+ *
34
36
* @see List.of
35
37
*/
36
38
fun <T > list (vararg t : T ):
37
39
List <T > = List .of(* t)
38
40
39
41
/* *
40
- * Converts a Value (that is, _any_ Vavr data class) into a Kotlin MutableList
42
+ * Converts a Vavr [ Value] (that is, _any_ Vavr data class) into a Kotlin [ MutableList].
41
43
*/
42
44
fun <T > Value<T>.toMutableList ():
43
45
MutableList <T > = this .toJavaList().toMutableList()
44
46
45
47
/* *
46
- * Converts a Kotlin Iterable into a List
48
+ * Converts a Kotlin [Iterable] into a Vavr [List].
49
+ *
50
+ * @see List.ofAll
47
51
*/
48
52
fun <T > Iterable<T>.toVavrList ():
49
53
List <T > = List .ofAll(this )
50
54
51
55
/* *
52
- * Converts a Kotlin Array into a List
56
+ * Converts a Kotlin [Array] into a Vavr [List].
57
+ *
58
+ * @see List.ofAll
53
59
*/
54
60
fun <T > Array<T>.toVavrList ():
55
61
List <T > = List .ofAll(this .asIterable())
56
62
57
63
/* *
64
+ * Creates a Vavr [Stream] of the given elements.
65
+ *
58
66
* @see Stream.of
59
67
*/
60
68
fun <T > stream (vararg t : T ):
61
69
Stream <T > = Stream .of(* t)
62
70
63
71
/* *
72
+ * Converts a Kotlin [Iterable] into a Vavr [Stream].
73
+ *
64
74
* @see Stream.ofAll
65
75
*/
66
76
fun <T > Iterable<T>.toVavrStream ():
67
77
Stream <T > = Stream .ofAll(this )
68
78
69
79
/* *
70
- * Converts a Kotlin Array into a Stream
80
+ * Converts a Kotlin [Array] into a Vavr [Stream].
81
+ *
82
+ * @see Stream.ofAll
71
83
*/
72
84
fun <T > Array<T>.toVavrStream ():
73
85
Stream <T > = Stream .ofAll(this .asIterable())
74
86
75
87
/* *
76
- * Converts a Kotlin Sequence into a Stream
88
+ * Converts a Kotlin [Sequence] into a Vavr [Stream].
89
+ *
90
+ * @see Stream.ofAll
77
91
*/
78
92
fun <T > Sequence<T>.toVavrStream ():
79
93
Stream <T > = Stream .ofAll(this .asIterable())
80
94
81
95
/* *
82
- * Converts a Kotlin Map into a Vavr Map
96
+ * Converts a Kotlin [kotlin.collections.Map] into a Vavr [Map].
97
+ *
98
+ * @see HashMap.ofAll
83
99
*/
84
100
fun <K , V > kotlin.collections.Map <K , V >.toVavrMap ():
85
101
io.vavr.collection.Map <K , V > = io.vavr.collection.HashMap .ofAll(this )
86
102
87
103
/* *
88
- * Converts a Vavr Map to a Kotlin MutableMap
104
+ * Converts a Vavr [ Map] to a Kotlin [ MutableMap].
89
105
*/
90
106
fun <K , V > io.vavr.collection.Map <K , V >.toMutableMap ():
91
107
kotlin.collections.MutableMap <K , V > = this .toJavaMap().toMutableMap()
92
108
93
109
/* *
94
- * Creates a Vavr HashMap from a series of Kotlin Pairs
110
+ * Creates a Vavr [ HashMap] from a series of Kotlin [Pair]s.
95
111
*/
96
112
fun <K , V > hashMap (vararg p : Pair <K , V >):
97
113
io.vavr.collection.HashMap <K , V > =
98
114
io.vavr.collection.HashMap .ofEntries(p.asIterable().map { it.tuple() })
99
115
100
116
/* *
101
- * Creates a Vavr LinkedHashMap from a series of Kotlin Pairs
117
+ * Creates a Vavr [ LinkedHashMap] from a series of Kotlin [Pair]s.
102
118
*/
103
119
fun <K , V > linkedHashMap (vararg p : Pair <K , V >):
104
120
io.vavr.collection.LinkedHashMap <K , V > =
105
121
io.vavr.collection.LinkedHashMap .ofEntries(p.asIterable().map { it.tuple() })
106
122
107
123
/* *
108
- * Creates a Vavr TreeMap from a series of Kotlin Pairs.
109
- * Notice that the keys of a TreeMap must be Comparable
124
+ * Creates a Vavr [TreeMap] from a series of Kotlin [Pair]s.
125
+ *
126
+ * Note that the keys of a [TreeMap] must be [Comparable].
127
+ *
128
+ * @param K a [Comparable] key
129
+ * @see TreeMap.ofEntries
110
130
*/
111
131
fun <K : Comparable <K >, V > treeMap (vararg p : Pair <K , V >):
112
132
io.vavr.collection.TreeMap <K , V > =
113
133
io.vavr.collection.TreeMap .ofEntries(p.asIterable().map { it.tuple() })
114
134
115
135
/* *
116
- * Returns the value associated with a key, or null if the key is not contained in the map.
136
+ * Returns the value associated with a key, or null if the key is not contained in the [Map].
137
+ *
138
+ * @see Map.getOrElse
117
139
*/
118
140
fun <K , V > Map <K , V >.getOrNull (key : K ):
119
141
V ? = this .getOrElse(key, null )
120
142
121
143
/* *
122
- * Converts a Kotlin Set into a Vavr Set
144
+ * Creates a Vavr [HashSet] of the given elements.
145
+ *
146
+ * @see HashSet.ofAll
123
147
*/
124
148
fun <T > kotlin.collections.Set<T>.toVavrSet ():
125
149
io.vavr.collection.Set <T > = io.vavr.collection.HashSet .ofAll(this )
126
150
127
151
/* *
128
- * Converts a Vavr Set into a Kotlin MutableSet
152
+ * Converts a Kotlin [Array] into a Vavr [Set].
153
+ *
154
+ * @see HashSet.ofAll
129
155
*/
130
156
fun <T > io.vavr.collection.Set<T>.toMutableSet ():
131
157
kotlin.collections.MutableSet <T > = this .toJavaSet().toMutableSet()
132
158
133
159
/* *
134
- * Creates a Vavr HashSet
160
+ * Converts a Kotlin [Sequence] into a Vavr [List].
161
+ *
162
+ * @see HashSet.ofAll
135
163
*/
136
164
fun <T > hashSet (vararg t : T ):
137
165
io.vavr.collection.HashSet <T > = io.vavr.collection.HashSet .ofAll(t.asIterable())
138
166
139
167
/* *
140
- * Creates a Vavr LinkedHashSet
168
+ * Creates a Vavr [LinkedHashSet] of the given elements.
169
+ *
170
+ * @see LinkedHashSet.ofAll
141
171
*/
142
172
fun <T > linkedHashSet (vararg t : T ):
143
173
io.vavr.collection.LinkedHashSet <T > = io.vavr.collection.LinkedHashSet .ofAll(t.asIterable())
144
174
145
175
/* *
146
- * Creates a Vavr TreeSet.
147
- * Notice that the elements of a TreeSet must be Comparable
176
+ * Creates a Vavr [TreeSet] from a series of Kotlin [Pair]s.
177
+ *
178
+ * Note that the elements of a [TreeSet] must be [Comparable].
179
+ *
180
+ * @param t a [Comparable] element
181
+ * @see TreeSet.ofAll
148
182
*/
149
183
fun <T : Comparable <T >> treeSet (vararg t : T ):
150
184
io.vavr.collection.TreeSet <T > =
0 commit comments