From a65a36589a70f1ebf426bffbbaff90bba3930597 Mon Sep 17 00:00:00 2001 From: Petrus Nguyen Thai Hoc Date: Tue, 13 Feb 2024 20:55:43 +0700 Subject: [PATCH] rename `ForkJoinStream.combine2`..`combine9` to `ForkJoinStream.join2`..`join9` --- lib/src/rx.dart | 16 ++++++++-------- lib/src/streams/fork_join.dart | 29 +++++++++++++++-------------- test/streams/fork_join_test.dart | 2 +- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/lib/src/rx.dart b/lib/src/rx.dart index e7770a72e..84d10088b 100644 --- a/lib/src/rx.dart +++ b/lib/src/rx.dart @@ -508,7 +508,7 @@ abstract class Rx { /// .listen(print); //prints 3 static Stream forkJoin2(Stream streamA, Stream streamB, T Function(A a, B b) combiner) => - ForkJoinStream.combine2(streamA, streamB, combiner); + ForkJoinStream.join2(streamA, streamB, combiner); /// Merges the given Streams into a single Stream sequence by using the /// [combiner] function when all of the stream sequences emits their @@ -524,7 +524,7 @@ abstract class Rx { /// .listen(print); //prints 'abd' static Stream forkJoin3(Stream streamA, Stream streamB, Stream streamC, T Function(A a, B b, C c) combiner) => - ForkJoinStream.combine3(streamA, streamB, streamC, combiner); + ForkJoinStream.join3(streamA, streamB, streamC, combiner); /// Merges the given Streams into a single Stream sequence by using the /// [combiner] function when all of the stream sequences emits their @@ -545,7 +545,7 @@ abstract class Rx { Stream streamC, Stream streamD, T Function(A a, B b, C c, D d) combiner) => - ForkJoinStream.combine4(streamA, streamB, streamC, streamD, combiner); + ForkJoinStream.join4(streamA, streamB, streamC, streamD, combiner); /// Merges the given Streams into a single Stream sequence by using the /// [combiner] function when all of the stream sequences emits their @@ -568,7 +568,7 @@ abstract class Rx { Stream streamD, Stream streamE, T Function(A a, B b, C c, D d, E e) combiner) => - ForkJoinStream.combine5( + ForkJoinStream.join5( streamA, streamB, streamC, streamD, streamE, combiner); /// Merges the given Streams into a single Stream sequence by using the @@ -594,7 +594,7 @@ abstract class Rx { Stream streamE, Stream streamF, T Function(A a, B b, C c, D d, E e, F f) combiner) => - ForkJoinStream.combine6( + ForkJoinStream.join6( streamA, streamB, streamC, streamD, streamE, streamF, combiner); /// Merges the given Streams into a single Stream sequence by using the @@ -622,7 +622,7 @@ abstract class Rx { Stream streamF, Stream streamG, T Function(A a, B b, C c, D d, E e, F f, G g) combiner) => - ForkJoinStream.combine7(streamA, streamB, streamC, streamD, streamE, + ForkJoinStream.join7(streamA, streamB, streamC, streamD, streamE, streamF, streamG, combiner); /// Merges the given Streams into a single Stream sequence by using the @@ -652,7 +652,7 @@ abstract class Rx { Stream streamG, Stream streamH, T Function(A a, B b, C c, D d, E e, F f, G g, H h) combiner) => - ForkJoinStream.combine8( + ForkJoinStream.join8( streamA, streamB, streamC, @@ -693,7 +693,7 @@ abstract class Rx { Stream streamH, Stream streamI, T Function(A a, B b, C c, D d, E e, F f, G g, H h, I i) combiner) => - ForkJoinStream.combine9( + ForkJoinStream.join9( streamA, streamB, streamC, diff --git a/lib/src/streams/fork_join.dart b/lib/src/streams/fork_join.dart index 84e4bea70..af0c91786 100644 --- a/lib/src/streams/fork_join.dart +++ b/lib/src/streams/fork_join.dart @@ -35,20 +35,21 @@ import 'package:rxdart/src/utils/subscription.dart'; /// ForkJoinStream.list([ /// Stream.fromIterable(['a']), /// Stream.fromIterable(['b']), -/// Stream.fromIterable(['C', 'D'])]) +/// Stream.fromIterable(['C', 'D']), +/// ]) /// .listen(print); //prints ['a', 'b', 'D'] /// /// ### Example with combiner /// /// If you wish to combine the list of values into a new object before you /// -/// CombineLatestStream( +/// ForkJoinStream( /// [ /// Stream.fromIterable(['a']), /// Stream.fromIterable(['b']), -/// Stream.fromIterable(['C', 'D']) +/// Stream.fromIterable(['C', 'D']), /// ], -/// (values) => values.last +/// (values) => values.last, /// ) /// .listen(print); //prints 'D' /// @@ -56,9 +57,9 @@ import 'package:rxdart/src/utils/subscription.dart'; /// /// If you wish to combine a specific number of Streams together with proper /// types information for the value of each Stream, use the -/// [combine2] - [combine9] operators. +/// [join2] - [join9] operators. /// -/// ForkJoinStream.combine2( +/// ForkJoinStream.forkJoin2( /// Stream.fromIterable([1]), /// Stream.fromIterable([2, 3]), /// (a, b) => a + b, @@ -87,7 +88,7 @@ class ForkJoinStream extends StreamView { /// Constructs a [Stream] that awaits the last values the provided [Stream]s, /// then calls the [combiner] to emit an event of type [R]. /// After this event, the [Stream] closes. - static ForkJoinStream combine2( + static ForkJoinStream join2( Stream streamOne, Stream streamTwo, R Function(A a, B b) combiner, @@ -100,7 +101,7 @@ class ForkJoinStream extends StreamView { /// Constructs a [Stream] that awaits the last values the provided [Stream]s, /// then calls the [combiner] to emit an event of type [R]. /// After this event, the [Stream] closes. - static ForkJoinStream combine3( + static ForkJoinStream join3( Stream streamA, Stream streamB, Stream streamC, @@ -120,7 +121,7 @@ class ForkJoinStream extends StreamView { /// Constructs a [Stream] that awaits the last values the provided [Stream]s, /// then calls the [combiner] to emit an event of type [R]. /// After this event, the [Stream] closes. - static ForkJoinStream combine4( + static ForkJoinStream join4( Stream streamA, Stream streamB, Stream streamC, @@ -142,7 +143,7 @@ class ForkJoinStream extends StreamView { /// Constructs a [Stream] that awaits the last values the provided [Stream]s, /// then calls the [combiner] to emit an event of type [R]. /// After this event, the [Stream] closes. - static ForkJoinStream combine5( + static ForkJoinStream join5( Stream streamA, Stream streamB, Stream streamC, @@ -166,7 +167,7 @@ class ForkJoinStream extends StreamView { /// Constructs a [Stream] that awaits the last values the provided [Stream]s, /// then calls the [combiner] to emit an event of type [R]. /// After this event, the [Stream] closes. - static ForkJoinStream combine6( + static ForkJoinStream join6( Stream streamA, Stream streamB, Stream streamC, @@ -192,7 +193,7 @@ class ForkJoinStream extends StreamView { /// Constructs a [Stream] that awaits the last values the provided [Stream]s, /// then calls the [combiner] to emit an event of type [R]. /// After this event, the [Stream] closes. - static ForkJoinStream combine7( + static ForkJoinStream join7( Stream streamA, Stream streamB, Stream streamC, @@ -220,7 +221,7 @@ class ForkJoinStream extends StreamView { /// Constructs a [Stream] that awaits the last values the provided [Stream]s, /// then calls the [combiner] to emit an event of type [R]. /// After this event, the [Stream] closes. - static ForkJoinStream combine8( + static ForkJoinStream join8( Stream streamA, Stream streamB, Stream streamC, @@ -259,7 +260,7 @@ class ForkJoinStream extends StreamView { /// Constructs a [Stream] that awaits the last values the provided [Stream]s, /// then calls the [combiner] to emit an event of type [R]. /// After this event, the [Stream] closes. - static ForkJoinStream combine9( + static ForkJoinStream join9( Stream streamA, Stream streamB, Stream streamC, diff --git a/test/streams/fork_join_test.dart b/test/streams/fork_join_test.dart index 978a15875..75ac99d23 100644 --- a/test/streams/fork_join_test.dart +++ b/test/streams/fork_join_test.dart @@ -36,7 +36,7 @@ void main() { test('Rx.forkJoin.nullable', () { expect( - ForkJoinStream.combine2( + ForkJoinStream.join2( Stream.value(null), Stream.value(1), (a, b) => '$a $b',