Interface TwoSide

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface TwoSide
    To be able to program with natural API in a two side context.

    Created at 19/03/2024.

    Since:
    1.1.13
    Author:
    Tony Chemit - dev@tchemit.fr
    • Method Detail

      • onLeft

        boolean onLeft()
        Returns:
        true if this object represents the left side, false otherwise.
      • get

        default <O> O get​(O leftCandidate,
                          O rightCandidate)
        Choose the correct object for this side.
        Type Parameters:
        O - type of candidate
        Parameters:
        leftCandidate - the left side candidate
        rightCandidate - the right side candidate
        Returns:
        the candidate for this side
      • consume

        default <O> void consume​(O o,
                                 Consumer<O> leftCandidate,
                                 Consumer<O> rightCandidate)
      • apply

        default <O,​V> V apply​(O o,
                                    Function<O,​V> leftCandidate,
                                    Function<O,​V> rightCandidate)
      • test

        default <O> boolean test​(O o,
                                 Predicate<O> leftCandidate,
                                 Predicate<O> rightCandidate)