<commit_before>[[reactor-extra]]
= Reactor-Extra

The `reactor-extra` artifact contains additional operators and utilities that are for
users of `reactor-core` with advanced needs.

As this is a separate artifact, you need to explicitly add it to your build. The following
example shows how to do so in Gradle:

====
[source,groovy]
----
dependencies {
     compile 'io.projectreactor:reactor-core'
     compile 'io.projectreactor.addons:reactor-extra' <1>
}
----
<1> Add the reactor extra artifact in addition to core. See <<getting>> for details
about why you do not need to specify a version if you use the BOM, usage in Maven, and other details.
====

[[extra-tuples]]
== `TupleUtils` and Functional Interfaces

The `reactor.function` package contains functional interfaces that complement the Java 8
`Function`, `Predicate`, and `Consumer` interfaces, for three to eight values.

`TupleUtils` offers static methods that act as a bridge between lambdas of these functional
interfaces to a similar interface on the corresponding `Tuple`.

This lets you easily work with independent parts of any `Tuple`, as the following example shows:

====
[source,java]
----
.map(tuple -> {
  String firstName = tuple.getT1();
  String lastName = tuple.getT2();
  String address = tuple.getT3();

  return new Customer(firstName, lastName, address);
});
----
====

You can rewrite the preceding example as follows:

====
[source,java]
----
.map(TupleUtils.function(Customer::new)); // <1>
----
<1> (as `Customer` constructor conforms to `Function3` functional interface signature)
====

[[extra-math]]
== Math Operators With `MathFlux`

The `reactor.math` package contains a `MathFlux` specialized version of `Flux` that offers
mathematical operators, including `max`, `min`, `sumInt`, `averageDouble`, and others.

[[extra-schedulers]]
== Schedulers

Reactor-extra comes with several specialized schedulers:

* `ForkJoinPoolScheduler` (in the `reactor.scheduler.forkjoin` package): Uses the Java `ForkJoinPool` to execute tasks.
* `SwingScheduler` (in the `reactor.swing` package): Runs tasks in the Swing UI event loop thread, the `EDT`.
* `SwtScheduler` (in the `reactor.swing` package): Runs tasks in the SWT UI event loop thread.
<commit_msg>[guide] Remove ref to Swing/SwtScheduler in addons appendix (#2959)<commit_after>[[reactor-extra]]
= Reactor-Extra

The `reactor-extra` artifact contains additional operators and utilities that are for
users of `reactor-core` with advanced needs, or incubating operators.

As this is a separate artifact, you need to explicitly add it to your build. The following
example shows how to do so in Gradle:

====
[source,groovy]
----
dependencies {
     compile 'io.projectreactor:reactor-core'
     compile 'io.projectreactor.addons:reactor-extra' <1>
}
----
<1> Add the reactor extra artifact in addition to core. See <<getting>> for details
about why you do not need to specify a version if you use the BOM, usage in Maven, and other details.
====

[[extra-tuples]]
== `TupleUtils` and Functional Interfaces

The `reactor.function` package contains functional interfaces that complement the Java 8
`Function`, `Predicate`, and `Consumer` interfaces, for three to eight values.

`TupleUtils` offers static methods that act as a bridge between lambdas of these functional
interfaces to a similar interface on the corresponding `Tuple`.

This lets you easily work with independent parts of any `Tuple`, as the following example shows:

====
[source,java]
----
.map(tuple -> {
  String firstName = tuple.getT1();
  String lastName = tuple.getT2();
  String address = tuple.getT3();

  return new Customer(firstName, lastName, address);
});
----
====

You can rewrite the preceding example as follows:

====
[source,java]
----
.map(TupleUtils.function(Customer::new)); // <1>
----
<1> (as `Customer` constructor conforms to `Function3` functional interface signature)
====

[[extra-math]]
== Math Operators With `MathFlux`

The `reactor.math` package contains a `MathFlux` specialized version of `Flux` that offers
mathematical operators, including `max`, `min`, `sumInt`, `averageDouble`, and others.

[[extra-schedulers]]
== Schedulers

Reactor-extra comes with the `ForkJoinPoolScheduler` (in the `reactor.scheduler.forkjoin` package): it uses the Java `ForkJoinPool` to execute tasks.

{'fraction_non_alphanumeric': 0.11533117183881426, 'fraction_numerical': 0.005094951366373321, 'mean_word_length': 4.758666666666667, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4806217', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1224, 'n_words': 508}