Tabnine Logo
StreamUtils.completableFutureToStream
Code IndexAdd Tabnine to your IDE (free)

How to use
completableFutureToStream
method
in
com.aol.cyclops.streams.StreamUtils

Best Java code snippets using com.aol.cyclops.streams.StreamUtils.completableFutureToStream (Showing top 2 results out of 315)

origin: com.aol.cyclops/cyclops-streams

/**
 *<pre>
 * {@code 
 *     assertThat(StreamUtils.flatMapCompletableFuture(Stream.of(1,2,3),
 *                                 i->CompletableFuture.completedFuture(i+2))
 *                                 .collect(Collectors.toList()),
 *                                 equalTo(Arrays.asList(3,4,5)));
 * }
 *</pre>
 */
public final static <T,R> Stream<R> flatMapCompletableFuture(Stream<T> stream,Function<? super T,CompletableFuture<? extends R>> fn) {
  return	stream.flatMap( in->StreamUtils.completableFutureToStream(fn.apply(in)));
  
}

origin: com.aol.cyclops/cyclops-base

/**
 * flatMap to CompletableFuture - will block until Future complete, although (for non-blocking behaviour use AnyM 
 *       wrapping CompletableFuture and flatMap to Stream there)
 *       
 *  <pre>
 *  {@code
 *      assertThat(SequenceM.of(1,2,3).flatMapCompletableFuture(i->CompletableFuture.completedFuture(i+2))
                       .collect(Collectors.toList()),
                       equalTo(Arrays.asList(3,4,5)));
 *  }
 *  </pre>
 *       
 * @param fn
 * @return
 */
public final <R> SequenceM<R> flatMapCompletableFuture(Function<? super T,CompletableFuture<? extends R>> fn) {
  return new SequenceM<>(monad.flatMap( in->StreamUtils.completableFutureToStream(fn.apply(in))));
}
public final <R> SequenceM<R> flatMapLazySeq(Function<? super T,LazySeq<? extends R>> fn) {
com.aol.cyclops.streamsStreamUtilscompletableFutureToStream

Popular methods of StreamUtils

  • cycle
    Convert to a Stream with the result of a reduction operation repeated specified times
  • stream
  • collect
    Apply multiple Collectors, simultaneously to a Stream
  • reduce
    Simultanously reduce a stream with multiple reducers
  • reverse
    Reverse a Stream
  • reversedStream
    Create a reversed Stream from a List
  • concat
    Concat an Object and a Stream If the Object is a Stream, Streamable or Iterable will be converted (o
  • forEachEvent
    Perform a forEach operation over the Stream capturing any elements and errors in the supplied consum
  • forEachWithError
    Perform a forEach operation over the Stream capturing any elements and errors in the supplied consum
  • forEachX
    Perform a forEach operation over the Stream, without closing it, consuming only the specified number
  • forEachXEvents
    Perform a forEach operation over the Stream without closing it, capturing any elements and errors in
  • forEachXWithError
    Perform a forEach operation over the Stream without closing it, capturing any elements and errors in
  • forEachXEvents,
  • forEachXWithError,
  • headAndTail,
  • headAndTailOptional,
  • join,
  • limitUntil,
  • limitWhile,
  • max,
  • maxBy

Popular in Java

  • Start an intent from android
  • runOnUiThread (Activity)
  • onRequestPermissionsResult (Fragment)
  • getSystemService (Context)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • JButton (javax.swing)
  • Option (scala)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now