Skip to content

Navigation Menu

Sign inAppearance settings
Appearance settings

Commit bdd53ee

Browse filesBrowse the repository at this point in the historyBrowse files
committed
Introduce new overloads of flatMap and flatMapTo
- Sequence<T>.flatMap((T) -> Iterable<R>) - Iterable<T>.flatMap((T) -> Sequence<R>) - Array<T>.flatMap((T) -> Sequence<R>) - Map.flatMap((Entry) -> Sequence<R>) KT-34506
1 parent 562788c commit bdd53ee
Copy full SHA for bdd53ee

10 files changed

+233-9Lines changed: 233 additions & 9 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎libraries/stdlib/common/src/generated/_Arrays.kt‎

Copy file name to clipboardExpand all lines: libraries/stdlib/common/src/generated/_Arrays.kt
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10032,6 +10032,19 @@ public inline fun <R> CharArray.flatMap(transform: (Char) -> Iterable<R>): List<
1003210032
return flatMapTo(ArrayList<R>(), transform)
1003310033
}
1003410034

10035+
/**
10036+
* Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.
10037+
*
10038+
* @sample samples.collections.Collections.Transformations.flatMap
10039+
*/
10040+
@SinceKotlin("1.4")
10041+
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
10042+
@OverloadResolutionByLambdaReturnType
10043+
@kotlin.jvm.JvmName("flatMapSequence")
10044+
public inline fun <T, R> Array<out T>.flatMap(transform: (T) -> Sequence<R>): List<R> {
10045+
return flatMapTo(ArrayList<R>(), transform)
10046+
}
10047+
1003510048
/**
1003610049
* Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].
1003710050
*/
@@ -10131,6 +10144,21 @@ public inline fun <R, C : MutableCollection<in R>> CharArray.flatMapTo(destinati
1013110144
return destination
1013210145
}
1013310146

10147+
/**
10148+
* Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].
10149+
*/
10150+
@SinceKotlin("1.4")
10151+
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
10152+
@OverloadResolutionByLambdaReturnType
10153+
@kotlin.jvm.JvmName("flatMapSequenceTo")
10154+
public inline fun <T, R, C : MutableCollection<in R>> Array<out T>.flatMapTo(destination: C, transform: (T) -> Sequence<R>): C {
10155+
for (element in this) {
10156+
val list = transform(element)
10157+
destination.addAll(list)
10158+
}
10159+
return destination
10160+
}
10161+
1013410162
/**
1013510163
* Groups elements of the original array by the key returned by the given [keySelector] function
1013610164
* applied to each element and returns a map where each group key is associated with a list of corresponding elements.
Collapse file

‎libraries/stdlib/common/src/generated/_Collections.kt‎

Copy file name to clipboardExpand all lines: libraries/stdlib/common/src/generated/_Collections.kt
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,19 @@ public inline fun <T, R> Iterable<T>.flatMap(transform: (T) -> Iterable<R>): Lis
12861286
return flatMapTo(ArrayList<R>(), transform)
12871287
}
12881288

1289+
/**
1290+
* Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection.
1291+
*
1292+
* @sample samples.collections.Collections.Transformations.flatMap
1293+
*/
1294+
@SinceKotlin("1.4")
1295+
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
1296+
@OverloadResolutionByLambdaReturnType
1297+
@kotlin.jvm.JvmName("flatMapSequence")
1298+
public inline fun <T, R> Iterable<T>.flatMap(transform: (T) -> Sequence<R>): List<R> {
1299+
return flatMapTo(ArrayList<R>(), transform)
1300+
}
1301+
12891302
/**
12901303
* Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination].
12911304
*/
@@ -1297,6 +1310,21 @@ public inline fun <T, R, C : MutableCollection<in R>> Iterable<T>.flatMapTo(dest
12971310
return destination
12981311
}
12991312

1313+
/**
1314+
* Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination].
1315+
*/
1316+
@SinceKotlin("1.4")
1317+
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
1318+
@OverloadResolutionByLambdaReturnType
1319+
@kotlin.jvm.JvmName("flatMapSequenceTo")
1320+
public inline fun <T, R, C : MutableCollection<in R>> Iterable<T>.flatMapTo(destination: C, transform: (T) -> Sequence<R>): C {
1321+
for (element in this) {
1322+
val list = transform(element)
1323+
destination.addAll(list)
1324+
}
1325+
return destination
1326+
}
1327+
13001328
/**
13011329
* Groups elements of the original collection by the key returned by the given [keySelector] function
13021330
* applied to each element and returns a map where each group key is associated with a list of corresponding elements.
Collapse file

‎libraries/stdlib/common/src/generated/_Maps.kt‎

Copy file name to clipboardExpand all lines: libraries/stdlib/common/src/generated/_Maps.kt
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,19 @@ public inline fun <K, V, R> Map<out K, V>.flatMap(transform: (Map.Entry<K, V>) -
4646
return flatMapTo(ArrayList<R>(), transform)
4747
}
4848

49+
/**
50+
* Returns a single list of all elements yielded from results of [transform] function being invoked on each entry of original map.
51+
*
52+
* @sample samples.collections.Collections.Transformations.flatMap
53+
*/
54+
@SinceKotlin("1.4")
55+
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
56+
@OverloadResolutionByLambdaReturnType
57+
@kotlin.jvm.JvmName("flatMapSequence")
58+
public inline fun <K, V, R> Map<out K, V>.flatMap(transform: (Map.Entry<K, V>) -> Sequence<R>): List<R> {
59+
return flatMapTo(ArrayList<R>(), transform)
60+
}
61+
4962
/**
5063
* Appends all elements yielded from results of [transform] function being invoked on each entry of original map, to the given [destination].
5164
*/
@@ -57,6 +70,21 @@ public inline fun <K, V, R, C : MutableCollection<in R>> Map<out K, V>.flatMapTo
5770
return destination
5871
}
5972

73+
/**
74+
* Appends all elements yielded from results of [transform] function being invoked on each entry of original map, to the given [destination].
75+
*/
76+
@SinceKotlin("1.4")
77+
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
78+
@OverloadResolutionByLambdaReturnType
79+
@kotlin.jvm.JvmName("flatMapSequenceTo")
80+
public inline fun <K, V, R, C : MutableCollection<in R>> Map<out K, V>.flatMapTo(destination: C, transform: (Map.Entry<K, V>) -> Sequence<R>): C {
81+
for (element in this) {
82+
val list = transform(element)
83+
destination.addAll(list)
84+
}
85+
return destination
86+
}
87+
6088
/**
6189
* Returns a list containing the results of applying the given [transform] function
6290
* to each entry in the original map.
Collapse file

‎libraries/stdlib/common/src/generated/_Sequences.kt‎

Copy file name to clipboardExpand all lines: libraries/stdlib/common/src/generated/_Sequences.kt
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,21 @@ public fun <T> Sequence<T>.toSet(): Set<T> {
765765
return toCollection(LinkedHashSet<T>()).optimizeReadOnlySet()
766766
}
767767

768+
/**
769+
* Returns a single sequence of all elements from results of [transform] function being invoked on each element of original sequence.
770+
*
771+
* The operation is _intermediate_ and _stateless_.
772+
*
773+
* @sample samples.collections.Collections.Transformations.flatMap
774+
*/
775+
@SinceKotlin("1.4")
776+
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
777+
@OverloadResolutionByLambdaReturnType
778+
@kotlin.jvm.JvmName("flatMapIterable")
779+
public fun <T, R> Sequence<T>.flatMap(transform: (T) -> Iterable<R>): Sequence<R> {
780+
return FlatteningSequence(this, transform, { it.iterator() })
781+
}
782+
768783
/**
769784
* Returns a single sequence of all elements from results of [transform] function being invoked on each element of original sequence.
770785
*
@@ -776,6 +791,23 @@ public fun <T, R> Sequence<T>.flatMap(transform: (T) -> Sequence<R>): Sequence<R
776791
return FlatteningSequence(this, transform, { it.iterator() })
777792
}
778793

794+
/**
795+
* Appends all elements yielded from results of [transform] function being invoked on each element of original sequence, to the given [destination].
796+
*
797+
* The operation is _terminal_.
798+
*/
799+
@SinceKotlin("1.4")
800+
@OptIn(kotlin.experimental.ExperimentalTypeInference::class)
801+
@OverloadResolutionByLambdaReturnType
802+
@kotlin.jvm.JvmName("flatMapIterableTo")
803+
public inline fun <T, R, C : MutableCollection<in R>> Sequence<T>.flatMapTo(destination: C, transform: (T) -> Iterable<R>): C {
804+
for (element in this) {
805+
val list = transform(element)
806+
destination.addAll(list)
807+
}
808+
return destination
809+
}
810+
779811
/**
780812
* Appends all elements yielded from results of [transform] function being invoked on each element of original sequence, to the given [destination].
781813
*
Collapse file

‎libraries/stdlib/test/collections/ArraysTest.kt‎

Copy file name to clipboardExpand all lines: libraries/stdlib/test/collections/ArraysTest.kt
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import test.assertTypeEquals
1212
import test.collections.behaviors.*
1313
import test.comparisons.STRING_CASE_INSENSITIVE_ORDER
1414
import test.text.isAsciiLetter
15+
import kotlin.math.exp
1516
import kotlin.test.*
1617
import kotlin.random.Random
1718

@@ -1756,6 +1757,15 @@ class ArraysTest {
17561757
assertEquals(listOf(2), arrayOf("a", null, "test").mapIndexedNotNull { index, it -> it?.run { if (index != 0) length / index else null } })
17571758
}
17581759

1760+
@Test fun flatMap() {
1761+
val data = arrayOf(arrayOf(1, 2, 3), arrayOf(4, 5, 6))
1762+
val result1 = data.flatMap { it.asList() }
1763+
val result2 = data.flatMap { it.asSequence() }
1764+
val expected = (data[0] + data[1]).toList()
1765+
assertEquals(expected, result1)
1766+
assertEquals(expected, result2)
1767+
}
1768+
17591769
@Test fun flattenArray() {
17601770
val arr1: Array<Array<Int>> = arrayOf(arrayOf(1, 2, 3), arrayOf(4, 5, 6))
17611771
val arr2: Array<out Array<Int>> = arr1
Collapse file

‎libraries/stdlib/test/collections/CollectionTest.kt‎

Copy file name to clipboardExpand all lines: libraries/stdlib/test/collections/CollectionTest.kt
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ class CollectionTest {
4646
assertStaticAndRuntimeTypeIs<List<String>>(foo)
4747
}
4848

49+
50+
@Test fun flatMap() {
51+
val source = listOf(null, "foo", "bar")
52+
val result1 = source.flatMap { it.orEmpty().asSequence() }
53+
val result2 = source.flatMap { it.orEmpty().asIterable() }
54+
55+
val expected = "foobar".toList()
56+
assertEquals(expected, result1)
57+
assertEquals(expected, result2)
58+
}
59+
4960
/*
5061
@Test fun mapNotNull() {
5162
val data = listOf(null, "foo", null, "bar")
Collapse file

‎libraries/stdlib/test/collections/MapTest.kt‎

Copy file name to clipboardExpand all lines: libraries/stdlib/test/collections/MapTest.kt
+16-1Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
2+
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
44
*/
55

@@ -216,6 +216,21 @@ class MapTest {
216216
assertEquals(mapOf(8 to "Mells"), m3)
217217
}
218218

219+
@Test fun flatMap() {
220+
fun <T> list(entry: Map.Entry<T, T>): List<T> = listOf(entry.key, entry.value)
221+
fun <T> seq(entry: Map.Entry<T, T>): Sequence<T> = sequenceOf(entry.key, entry.value)
222+
val m = mapOf("x" to 1, "y" to 0)
223+
val result1 = m.flatMap { list(it) }
224+
val result2 = m.flatMap { seq(it) }
225+
val result3 = m.flatMap(::list)
226+
val result4 = m.flatMap(::seq)
227+
val expected = listOf("x", 1, "y", 0)
228+
assertEquals(expected, result1)
229+
assertEquals(expected, result2)
230+
assertEquals(expected, result3)
231+
assertEquals(expected, result4)
232+
}
233+
219234
@Test fun createFrom() {
220235
val pairs = arrayOf("a" to 1, "b" to 2)
221236
val expected = mapOf(*pairs)
Collapse file

‎libraries/stdlib/test/collections/SequenceTest.kt‎

Copy file name to clipboardExpand all lines: libraries/stdlib/test/collections/SequenceTest.kt
+12-6Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,18 +572,24 @@ public class SequenceTest {
572572
}
573573

574574
@Test fun flatMap() {
575-
val result = sequenceOf(1, 2).flatMap { (0..it).asSequence() }
576-
assertEquals(listOf(0, 1, 0, 1, 2), result.toList())
575+
val result1 = sequenceOf(1, 2).flatMap { (0..it).asSequence() }
576+
val result2 = sequenceOf(1, 2).flatMap { 0..it }
577+
val expected = listOf(0, 1, 0, 1, 2)
578+
assertEquals(expected, result1.toList())
579+
assertEquals(expected, result2.toList())
577580
}
578581

579582
@Test fun flatMapOnEmpty() {
580-
val result = sequenceOf<Int>().flatMap { (0..it).asSequence() }
581-
assertTrue(result.none())
583+
assertTrue(sequenceOf<Int>().flatMap { sequenceOf(1) }.none())
584+
assertTrue(sequenceOf<Int>().flatMap { listOf(1) }.none())
582585
}
583586

584587
@Test fun flatMapWithEmptyItems() {
585-
val result = sequenceOf(1, 2, 4).flatMap { if (it == 2) sequenceOf<Int>() else (it - 1..it).asSequence() }
586-
assertEquals(listOf(0, 1, 3, 4), result.toList())
588+
val result1 = sequenceOf(1, 2, 4).flatMap { if (it == 2) sequenceOf<Int>() else (it - 1..it).asSequence() }
589+
val result2 = sequenceOf(1, 2, 4).flatMap { if (it == 2) emptyList<Int>() else it - 1..it }
590+
val expected = listOf(0, 1, 3, 4)
591+
assertEquals(expected, result1.toList())
592+
assertEquals(expected, result2.toList())
587593
}
588594

589595
@Test fun flatten() {
Collapse file

‎libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt‎

Copy file name to clipboardExpand all lines: libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,8 @@ public final class kotlin/collections/ArraysKt {
10871087
public static final fun flatMap ([Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/util/List;
10881088
public static final fun flatMap ([SLkotlin/jvm/functions/Function1;)Ljava/util/List;
10891089
public static final fun flatMap ([ZLkotlin/jvm/functions/Function1;)Ljava/util/List;
1090+
public static final fun flatMapSequence ([Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/util/List;
1091+
public static final fun flatMapSequenceTo ([Ljava/lang/Object;Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/util/Collection;
10901092
public static final fun flatMapTo ([BLjava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/util/Collection;
10911093
public static final fun flatMapTo ([CLjava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/util/Collection;
10921094
public static final fun flatMapTo ([DLjava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/util/Collection;
@@ -2136,6 +2138,8 @@ public final class kotlin/collections/CollectionsKt {
21362138
public static final fun firstOrNull (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
21372139
public static final fun firstOrNull (Ljava/util/List;)Ljava/lang/Object;
21382140
public static final fun flatMap (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function1;)Ljava/util/List;
2141+
public static final fun flatMapSequence (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function1;)Ljava/util/List;
2142+
public static final fun flatMapSequenceTo (Ljava/lang/Iterable;Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/util/Collection;
21392143
public static final fun flatMapTo (Ljava/lang/Iterable;Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/util/Collection;
21402144
public static final fun flatten (Ljava/lang/Iterable;)Ljava/util/List;
21412145
public static final fun fold (Ljava/lang/Iterable;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Ljava/lang/Object;
@@ -2401,6 +2405,8 @@ public final class kotlin/collections/MapsKt {
24012405
public static final fun filterTo (Ljava/util/Map;Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Ljava/util/Map;
24022406
public static final fun filterValues (Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Ljava/util/Map;
24032407
public static final fun flatMap (Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Ljava/util/List;
2408+
public static final fun flatMapSequence (Ljava/util/Map;Lkotlin/jvm/functions/Function1;)Ljava/util/List;
2409+
public static final fun flatMapSequenceTo (Ljava/util/Map;Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/util/Collection;
24042410
public static final fun flatMapTo (Ljava/util/Map;Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/util/Collection;
24052411
public static final fun forEach (Ljava/util/Map;Lkotlin/jvm/functions/Function1;)V
24062412
public static final fun getOrImplicitDefaultNullable (Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
@@ -4780,6 +4786,8 @@ public final class kotlin/sequences/SequencesKt {
47804786
public static final fun firstOrNull (Lkotlin/sequences/Sequence;)Ljava/lang/Object;
47814787
public static final fun firstOrNull (Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
47824788
public static final fun flatMap (Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
4789+
public static final fun flatMapIterable (Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
4790+
public static final fun flatMapIterableTo (Lkotlin/sequences/Sequence;Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/util/Collection;
47834791
public static final fun flatMapTo (Lkotlin/sequences/Sequence;Ljava/util/Collection;Lkotlin/jvm/functions/Function1;)Ljava/util/Collection;
47844792
public static final fun flatten (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
47854793
public static final fun flattenSequenceOfIterable (Lkotlin/sequences/Sequence;)Lkotlin/sequences/Sequence;
Collapse file

‎libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt‎

Copy file name to clipboardExpand all lines: libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt
+60-2Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,37 @@ object Mapping : TemplateGroupBase() {
304304
}
305305
specialFor(Sequences) {
306306
inline(Inline.No)
307-
signature("flatMap(transform: (T) -> Sequence<R>)")
307+
since("1.4")
308+
annotation("@OptIn(kotlin.experimental.ExperimentalTypeInference::class)")
309+
annotation("@OverloadResolutionByLambdaReturnType")
310+
annotation("""@kotlin.jvm.JvmName("flatMapIterable")""")
311+
doc { "Returns a single sequence of all elements from results of [transform] function being invoked on each element of original sequence." }
312+
returns("Sequence<R>")
313+
body {
314+
"return FlatteningSequence(this, transform, { it.iterator() })"
315+
}
316+
}
317+
}
318+
319+
val f_flatMapSequence = fn("flatMap(transform: (T) -> Sequence<R>)") {
320+
include(Sequences, Iterables, ArraysOfObjects, Maps)
321+
} builder {
322+
inline()
323+
doc { "Returns a single list of all elements yielded from results of [transform] function being invoked on each ${f.element} of original ${f.collection}." }
324+
sample("samples.collections.Collections.Transformations.flatMap")
325+
typeParam("R")
326+
returns("List<R>")
327+
body {
328+
"return flatMapTo(ArrayList<R>(), transform)"
329+
}
330+
if (f != Sequences) {
331+
since("1.4")
332+
annotation("@OptIn(kotlin.experimental.ExperimentalTypeInference::class)")
333+
annotation("@OverloadResolutionByLambdaReturnType")
334+
annotation("""@kotlin.jvm.JvmName("flatMapSequence")""")
335+
}
336+
specialFor(Sequences) {
337+
inline(Inline.No)
308338
doc { "Returns a single sequence of all elements from results of [transform] function being invoked on each element of original sequence." }
309339
returns("Sequence<R>")
310340
body {
@@ -322,7 +352,35 @@ object Mapping : TemplateGroupBase() {
322352

323353
doc { "Appends all elements yielded from results of [transform] function being invoked on each ${f.element} of original ${f.collection}, to the given [destination]." }
324354
specialFor(Sequences) {
325-
signature("flatMapTo(destination: C, transform: (T) -> Sequence<R>)")
355+
since("1.4")
356+
annotation("@OptIn(kotlin.experimental.ExperimentalTypeInference::class)")
357+
annotation("@OverloadResolutionByLambdaReturnType")
358+
annotation("""@kotlin.jvm.JvmName("flatMapIterableTo")""")
359+
}
360+
typeParam("R")
361+
typeParam("C : MutableCollection<in R>")
362+
returns("C")
363+
body {
364+
"""
365+
for (element in this) {
366+
val list = transform(element)
367+
destination.addAll(list)
368+
}
369+
return destination
370+
"""
371+
}
372+
}
373+
374+
val f_flatMapToSequence = fn("flatMapTo(destination: C, transform: (T) -> Sequence<R>)") {
375+
include(Sequences, Iterables, ArraysOfObjects, Maps)
376+
} builder {
377+
inline()
378+
doc { "Appends all elements yielded from results of [transform] function being invoked on each ${f.element} of original ${f.collection}, to the given [destination]." }
379+
if (f != Sequences) {
380+
since("1.4")
381+
annotation("@OptIn(kotlin.experimental.ExperimentalTypeInference::class)")
382+
annotation("@OverloadResolutionByLambdaReturnType")
383+
annotation("""@kotlin.jvm.JvmName("flatMapSequenceTo")""")
326384
}
327385
typeParam("R")
328386
typeParam("C : MutableCollection<in R>")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.