A collection of pipes used to transform publishers including: filter, sort, map, flatMap...
- Since:
- 1.2
- Author:
- Jeremy Kuhn
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
R> PublisherPipe <T, R> Returns a pipe which transforms the elements of a publisher into publishers by applying the specified mapper function then flatten, these inner publishers into a single publisher, sequentially and preserving order using concatenation.static <T> PublisherPipe
<T, T> distinct()
Returns a pipe which converts a publisher to filter out duplicates.Returns a pipe which converts a publisher to filter out duplicates based on their keys computed using the specified key selector.static <T,
U> PublisherPipe <T, T> Returns a pipe which converts a publisher to filter out elements based on their keys computed using the specified key selector that do not pass the specified predicate test.static <T> PublisherPipe
<T, T> Returns a pipe which converts a publisher to filter out elements that do not pass the specified predicate test.static <T,
R> PublisherPipe <T, R> Returns a pipe which transforms the elements of a publisher into publishers by applying the specified mapper function, then flatten these inner publishers into a single publisher through merging, which allow them to interleave.static <T,
R> PublisherPipe <T, R> flatMapSequential
(Function<? super T, ? extends Publisher<? extends R>> mapper) Returns a pipe which transforms the elements of a publisher into publishers by applying the specified mapper function, then flatten these inner publishers into a single Flux, but merge them in the order of their source element.static <T,
R> PublisherPipe <T, R> Returns a pipe which transforms the elements of a publisher by applying the specified mapper function.static <T> PublisherPipe
<T, T> sort()
Returns a pipe which converts a publisher to sort the elements in natural order.static <T> PublisherPipe
<T, T> sort
(Comparator<? super T> comparator) Returns a pipe which converts a publisher to sort the elements using the specified comparator.
-
Constructor Details
-
PublisherPipes
public PublisherPipes()
-
-
Method Details
-
distinct
Returns a pipe which converts a publisher to filter out duplicates.
- Type Parameters:
T
- the type of element in the publisher- Returns:
- a publisher pipe
-
distinct
public static <T,U> Function<? super Publisher<T>,? extends Publisher<T>> distinct(Function<? super T, ? extends U> keySelector) Returns a pipe which converts a publisher to filter out duplicates based on their keys computed using the specified key selector.
- Type Parameters:
T
- the type of element in the publisherU
- the type of the computed keys- Parameters:
keySelector
- a key selector- Returns:
- a publisher pipe
-
sort
Returns a pipe which converts a publisher to sort the elements in natural order.
- Type Parameters:
T
- the type of element in the publisher- Returns:
- a publisher pipe
-
sort
Returns a pipe which converts a publisher to sort the elements using the specified comparator.
- Type Parameters:
T
- the type of element in the publisher- Parameters:
comparator
- a comparator- Returns:
- a publisher pipe
-
filter
Returns a pipe which converts a publisher to filter out elements that do not pass the specified predicate test.
- Type Parameters:
T
- the type of element in the publisher- Parameters:
predicate
- a predicate- Returns:
- a publisher pipe
-
filter
public static <T,U> PublisherPipe<T,T> filter(Function<? super T, ? extends U> keySelector, Predicate<? super U> predicate) Returns a pipe which converts a publisher to filter out elements based on their keys computed using the specified key selector that do not pass the specified predicate test.
- Type Parameters:
T
- the type of element in the publisherU
- the type of the computed keys- Parameters:
keySelector
- a key selectorpredicate
- a predicate- Returns:
- a publisher pipe
-
map
Returns a pipe which transforms the elements of a publisher by applying the specified mapper function.
- Type Parameters:
T
- the type of element in the publisherR
- the type of element in the resulting publisher- Parameters:
mapper
- a mapper function- Returns:
- a publisher pipe
-
concatMap
public static <T,R> PublisherPipe<T,R> concatMap(Function<? super T, ? extends Publisher<? extends R>> mapper) Returns a pipe which transforms the elements of a publisher into publishers by applying the specified mapper function then flatten, these inner publishers into a single publisher, sequentially and preserving order using concatenation.
- Type Parameters:
T
- the type of element in the publisherR
- the type of element in the resulting publisher- Parameters:
mapper
- a mapper function- Returns:
- a publisher pipe
-
flatMap
public static <T,R> PublisherPipe<T,R> flatMap(Function<? super T, ? extends Publisher<? extends R>> mapper) Returns a pipe which transforms the elements of a publisher into publishers by applying the specified mapper function, then flatten these inner publishers into a single publisher through merging, which allow them to interleave.
- Type Parameters:
T
- the type of element in the publisherR
- the type of element in the resulting publisher- Parameters:
mapper
- a mapper function- Returns:
- a publisher pipe
-
flatMapSequential
public static <T,R> PublisherPipe<T,R> flatMapSequential(Function<? super T, ? extends Publisher<? extends R>> mapper) Returns a pipe which transforms the elements of a publisher into publishers by applying the specified mapper function, then flatten these inner publishers into a single Flux, but merge them in the order of their source element.
- Type Parameters:
T
- the type of element in the publisherR
- the type of element in the resulting publisher- Parameters:
mapper
- a mapper function- Returns:
- a publisher pipe
-