Skip to content

Commit

Permalink
rename ForkJoinStream.combine2..combine9 to `ForkJoinStream.join2…
Browse files Browse the repository at this point in the history
…`..`join9`
  • Loading branch information
hoc081098 committed Feb 13, 2024
1 parent 6a10dc7 commit a65a365
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
16 changes: 8 additions & 8 deletions lib/src/rx.dart
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ abstract class Rx {
/// .listen(print); //prints 3
static Stream<T> forkJoin2<A, B, T>(Stream<A> streamA, Stream<B> 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
Expand All @@ -524,7 +524,7 @@ abstract class Rx {
/// .listen(print); //prints 'abd'
static Stream<T> forkJoin3<A, B, C, T>(Stream<A> streamA, Stream<B> streamB,
Stream<C> 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
Expand All @@ -545,7 +545,7 @@ abstract class Rx {
Stream<C> streamC,
Stream<D> 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
Expand All @@ -568,7 +568,7 @@ abstract class Rx {
Stream<D> streamD,
Stream<E> 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
Expand All @@ -594,7 +594,7 @@ abstract class Rx {
Stream<E> streamE,
Stream<F> 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
Expand Down Expand Up @@ -622,7 +622,7 @@ abstract class Rx {
Stream<F> streamF,
Stream<G> 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
Expand Down Expand Up @@ -652,7 +652,7 @@ abstract class Rx {
Stream<G> streamG,
Stream<H> 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,
Expand Down Expand Up @@ -693,7 +693,7 @@ abstract class Rx {
Stream<H> streamH,
Stream<I> 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,
Expand Down
29 changes: 15 additions & 14 deletions lib/src/streams/fork_join.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,31 @@ import 'package:rxdart/src/utils/subscription.dart';
/// ForkJoinStream.list<String>([
/// 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'
///
/// ### Example with a specific number of Streams
///
/// 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,
Expand Down Expand Up @@ -87,7 +88,7 @@ class ForkJoinStream<T, R> extends StreamView<R> {
/// 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<dynamic, R> combine2<A, B, R>(
static ForkJoinStream<dynamic, R> join2<A, B, R>(
Stream<A> streamOne,
Stream<B> streamTwo,
R Function(A a, B b) combiner,
Expand All @@ -100,7 +101,7 @@ class ForkJoinStream<T, R> extends StreamView<R> {
/// 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<dynamic, R> combine3<A, B, C, R>(
static ForkJoinStream<dynamic, R> join3<A, B, C, R>(
Stream<A> streamA,
Stream<B> streamB,
Stream<C> streamC,
Expand All @@ -120,7 +121,7 @@ class ForkJoinStream<T, R> extends StreamView<R> {
/// 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<dynamic, R> combine4<A, B, C, D, R>(
static ForkJoinStream<dynamic, R> join4<A, B, C, D, R>(
Stream<A> streamA,
Stream<B> streamB,
Stream<C> streamC,
Expand All @@ -142,7 +143,7 @@ class ForkJoinStream<T, R> extends StreamView<R> {
/// 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<dynamic, R> combine5<A, B, C, D, E, R>(
static ForkJoinStream<dynamic, R> join5<A, B, C, D, E, R>(
Stream<A> streamA,
Stream<B> streamB,
Stream<C> streamC,
Expand All @@ -166,7 +167,7 @@ class ForkJoinStream<T, R> extends StreamView<R> {
/// 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<dynamic, R> combine6<A, B, C, D, E, F, R>(
static ForkJoinStream<dynamic, R> join6<A, B, C, D, E, F, R>(
Stream<A> streamA,
Stream<B> streamB,
Stream<C> streamC,
Expand All @@ -192,7 +193,7 @@ class ForkJoinStream<T, R> extends StreamView<R> {
/// 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<dynamic, R> combine7<A, B, C, D, E, F, G, R>(
static ForkJoinStream<dynamic, R> join7<A, B, C, D, E, F, G, R>(
Stream<A> streamA,
Stream<B> streamB,
Stream<C> streamC,
Expand Down Expand Up @@ -220,7 +221,7 @@ class ForkJoinStream<T, R> extends StreamView<R> {
/// 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<dynamic, R> combine8<A, B, C, D, E, F, G, H, R>(
static ForkJoinStream<dynamic, R> join8<A, B, C, D, E, F, G, H, R>(
Stream<A> streamA,
Stream<B> streamB,
Stream<C> streamC,
Expand Down Expand Up @@ -259,7 +260,7 @@ class ForkJoinStream<T, R> extends StreamView<R> {
/// 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<dynamic, R> combine9<A, B, C, D, E, F, G, H, I, R>(
static ForkJoinStream<dynamic, R> join9<A, B, C, D, E, F, G, H, I, R>(
Stream<A> streamA,
Stream<B> streamB,
Stream<C> streamC,
Expand Down
2 changes: 1 addition & 1 deletion test/streams/fork_join_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit a65a365

Please sign in to comment.