Class OptionStep3<A,​B,​C>

  • Type Parameters:
    A - The type of the first defined value
    B - The type of the second defined value
    C - The type of the third defined value

    public final class OptionStep3<A,​B,​C>
    extends java.lang.Object
    The third step of the Option type.

    This class is not intended to be contructed manually, and should only be used as part of a Steps chain, started by Steps.begin(Option)

    Since:
    4.7.0
    See Also:
    for usage examples, Option
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      OptionStep3<A,​B,​C> filter​(Predicate3<? super A,​? super B,​? super C> predicate)
      Apply the provided predicate with the previous step results.
      OptionStep3<A,​B,​C> filterNot​(Predicate3<? super A,​? super B,​? super C> predicate)
      Apply the provided predicate with the previous step results.
      <D> OptionStep4<A,​B,​C,​D> then​(Function3<? super A,​? super B,​? super C,​? extends Option<? extends D>> functor)
      Apply the provided function with the previous Step results.
      <D> OptionStep4<A,​B,​C,​D> then​(java.util.function.Supplier<? extends Option<? extends D>> supplier)
      Apply the provided supplier with the previous Step results.
      <Z> Option<Z> yield​(Function3<? super A,​? super B,​? super C,​Z> functor)
      Terminating step expression, that will provide the previous steps to this function and return the result as a some
      • Methods inherited from class java.lang.Object

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

      • option1

        private final Option<A> option1
      • option2

        private final Option<B> option2
      • option3

        private final Option<C> option3
    • Method Detail

      • then

        public <D> OptionStep4<A,​B,​C,​D> then​(Function3<? super A,​? super B,​? super C,​? extends Option<? extends D>> functor)
        Apply the provided function with the previous Step results.

        Internally this will perform a Option.flatMap(Function) and the result will become the next step value.

        Type Parameters:
        D - The type of the next step result
        Parameters:
        functor - The functor to be applied as a flatMap with the previous steps
        Returns:
        The next step class
      • then

        public <D> OptionStep4<A,​B,​C,​D> then​(java.util.function.Supplier<? extends Option<? extends D>> supplier)
        Apply the provided supplier with the previous Step results.

        Internally this will perform a Option.flatMap(Function) and the supplier will become the next step value.

        This is different to then(Function3) in that the previous step results are not provided for the new step evaluation.

        Type Parameters:
        D - The type of the next step result
        Parameters:
        supplier - The supplier to provide the result of the flatMap with the previous step.
        Returns:
        The next step class
      • filter

        public OptionStep3<A,​B,​C> filter​(Predicate3<? super A,​? super B,​? super C> predicate)
        Apply the provided predicate with the previous step results.
        Parameters:
        predicate - The check that must be satisfied by contained values
        Returns:
        This step class with either the same last step value, or changed to none
      • filterNot

        public OptionStep3<A,​B,​C> filterNot​(Predicate3<? super A,​? super B,​? super C> predicate)
        Apply the provided predicate with the previous step results.
        Parameters:
        predicate - The check that must be dissatisfied by contained values
        Returns:
        This step class with either the same last step value, or changed to none
        Since:
        6.1
      • yield

        public <Z> Option<Z> yield​(Function3<? super A,​? super B,​? super C,​Z> functor)
        Terminating step expression, that will provide the previous steps to this function and return the result as a some
        Type Parameters:
        Z - The type for the returned result
        Parameters:
        functor - The yield function to map on previous values
        Returns:
        An Option containing this result or none