Class Either.OfThree<A,​B,​C>

  • Type Parameters:
    A - the type of the first possible value
    B - the type of the second possible value
    C - the type of the third possible value
    Direct Known Subclasses:
    NumOrTwoSeqOrNdArr
    Enclosing class:
    Either

    public static class Either.OfThree<A,​B,​C>
    extends Object
    Represents an exclusive choice between three possible types.
    • Constructor Detail

      • OfThree

        protected OfThree​(A first,
                          B second,
                          C third,
                          Either.Selector selector)
        Constructs an OfThree object with the specified values and selector.
        Parameters:
        first - the value of the first option
        second - the value of the second option
        third - the value of the third option
        selector - the selector indicating the current choice
    • Method Detail

      • first

        public static <A,​B,​C> Either.OfThree<A,​B,​C> first​(A first)
        Creates an OfThree instance with the first value selected.
        Type Parameters:
        A - the type of the first value
        B - the type of the second value
        C - the type of the third value
        Parameters:
        first - the value of the first option
        Returns:
        an OfThree instance with the first value selected
      • second

        public static <A,​B,​C> Either.OfThree<A,​B,​C> second​(B second)
        Creates an OfThree instance with the second value selected.
        Type Parameters:
        A - the type of the first value
        B - the type of the second value
        C - the type of the third value
        Parameters:
        second - the value of the second option
        Returns:
        an OfThree instance with the second value selected
      • third

        public static <A,​B,​C> Either.OfThree<A,​B,​C> third​(C third)
        Creates an OfThree instance with the third value selected.
        Type Parameters:
        A - the type of the first value
        B - the type of the second value
        C - the type of the third value
        Parameters:
        third - the value of the third option
        Returns:
        an OfThree instance with the third value selected
      • getFirst

        public A getFirst()
        Gets the first value if selected.
        Returns:
        the first value
        Throws:
        IllegalStateException - if the current selection is not First
      • getSecond

        public B getSecond()
        Gets the second value if selected.
        Returns:
        the second value
        Throws:
        IllegalStateException - if the current selection is not Second
      • getThird

        public C getThird()
        Gets the third value if selected.
        Returns:
        the third value
        Throws:
        IllegalStateException - if the current selection is not Third
      • getSelector

        public Either.Selector getSelector()
        Gets the current selector.
        Returns:
        the Selector indicating the current selection