Class RxJavaInterop


  • public class RxJavaInterop
    extends java.lang.Object
    Static factory class that provides methods to obtain commonly used instances for interoperation between RxJava and standard JRE.
    Since:
    10.0
    Author:
    wburns
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <E> java.util.function.Function<java.util.concurrent.CompletionStage<E>,​io.reactivex.Flowable<E>> completionStageToPublisher()
      Provides an interop function that can be used to convert a CompletionStage into a Flowable.
      static <K,​V>
      io.reactivex.functions.Function<java.util.Map.Entry<K,​V>,​K>
      entryToKeyFunction()
      Provides a Function that can be used to convert from an instance of Map.Entry to the key of the entry.
      static <E> io.reactivex.functions.Function<io.reactivex.Maybe<E>,​java.util.concurrent.CompletionStage<E>> maybeToCompletionStage()
      Provides an interop function that can be used to convert a Maybe into a CompletionStage.
      static <E> io.reactivex.functions.Function<io.reactivex.Single<E>,​java.util.concurrent.CompletionStage<E>> singleToCompletionStage()
      Provides an interop function that can be used to convert a Single into a CompletionStage.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • singleToCompletionStage

        public static <E> io.reactivex.functions.Function<io.reactivex.Single<E>,​java.util.concurrent.CompletionStage<E>> singleToCompletionStage()
        Provides an interop function that can be used to convert a Single into a CompletionStage. Note that this function is not from the standard java.util.function package, but rather Function to interop better with the Single.to(Function) method.
        Type Parameters:
        E - underlying type
        Returns:
        rxjava function to convert Single to CompletionStage
      • maybeToCompletionStage

        public static <E> io.reactivex.functions.Function<io.reactivex.Maybe<E>,​java.util.concurrent.CompletionStage<E>> maybeToCompletionStage()
        Provides an interop function that can be used to convert a Maybe into a CompletionStage. Note that this function is not from the standard java.util.function package, but rather Function to interop better with the Maybe.to(Function) method.
        Type Parameters:
        E - underlying type
        Returns:
        rxjava function to convert Maybe to CompletionStage
      • completionStageToPublisher

        public static <E> java.util.function.Function<java.util.concurrent.CompletionStage<E>,​io.reactivex.Flowable<E>> completionStageToPublisher()
        Provides an interop function that can be used to convert a CompletionStage into a Flowable. Note that this function is from the standard java.util.function package since we don't want the method to throw an exception

        Remember that the CompletionStage when completing normally MUST have a non null value!

        Type Parameters:
        E - underlying type
        Returns:
        java.util function to convert CompletionStage to Flowable
      • entryToKeyFunction

        public static <K,​V> io.reactivex.functions.Function<java.util.Map.Entry<K,​V>,​K> entryToKeyFunction()
        Provides a Function that can be used to convert from an instance of Map.Entry to the key of the entry. This is useful for the instance passed to a method like Flowable.map(Function).
        Type Parameters:
        K - key type
        V - value type
        Returns:
        rxjava function to convert from a Map.Entry to its key.