Class PromisesSet

java.lang.Object
org.smallibs.concurrent.promise.impl.SolvablePromise<Unit>
org.smallibs.concurrent.promise.impl.PromisesSet
All Implemented Interfaces:
Promise<Unit>, Filter<Promise,Unit,Promise<Unit>>, HK<Promise,Unit,Promise<Unit>>

public class PromisesSet extends SolvablePromise<Unit>
  • Constructor Details

  • Method Details

    • map

      public final <R> Promise<R> map(FunctionWithError<? super Unit,? extends R> function)
      Description copied from interface: Promise
      Method used to map a function. This mapping is done when the operation is a success. The result of this mapping is a new promise component.
      Specified by:
      map in interface Promise<T>
      Type Parameters:
      R - the promised value type
      Parameters:
      function - The function to apply on success which can raise an error
      Returns:
      a new promise
    • biMap

      public final <R> Promise<R> biMap(FunctionWithError<? super Unit,? extends R> onSuccess, FunctionWithError<? super Throwable,? extends R> onError)
      Description copied from interface: Promise
      Method used to map a function on success and another one on error. The result of this mapping is a new promise component.
      Specified by:
      biMap in interface Promise<T>
      Type Parameters:
      R - the promised value type
      Parameters:
      onSuccess - The function to apply on success which can raise an error
      onError - The function to apply on error which can also raise an error
      Returns:
      a new promise
    • flatmap

      public final <R> Promise<R> flatmap(java.util.function.Function<? super Unit,Promise<R>> function)
      Description copied from interface: Promise
      Method used to flatmap a function. This mapping is done when the operation is a success. The result of this mapping is a new promise component.
      Specified by:
      flatmap in interface Promise<T>
      Type Parameters:
      R - the promised value type
      Parameters:
      function - The function to apply on success
      Returns:
      a new promise
    • filter

      public final Promise<Unit> filter(java.util.function.Predicate<? super Unit> predicate)
      Description copied from interface: Filter
      Method called when the current data must be filtered using a given predicate.
      Specified by:
      filter in interface Filter<Promise,T,Promise<T>>
      Parameters:
      predicate - The filter
      Returns:
      a filtered data
    • self

      public final Promise<Unit> self()
      Specified by:
      self in interface HK<Promise,T,Promise<T>>