Class IsEq<A>


  • public final class IsEq<A>
    extends java.lang.Object
    Represents two values of the same type that are expected to be equal.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private A lhs  
      private A rhs  
    • Constructor Summary

      Constructors 
      Constructor Description
      IsEq​(A lhs, A rhs)
      Build an equality instance
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <A> IsEq<A> isEq​(A lhs, A rhs)
      Two equal elements
      A lhs()
      Access the left element
      <R> R match​(java.util.function.BiFunction<A,​A,​R> cases)
      Function to use for comparison of two equal elements
      A rhs()
      Access the right element
      • Methods inherited from class java.lang.Object

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

      • lhs

        private final A lhs
      • rhs

        private final A rhs
    • Constructor Detail

      • IsEq

        public IsEq​(A lhs,
                    A rhs)
        Build an equality instance
        Parameters:
        lhs - first value to compare
        rhs - second value to compare
    • Method Detail

      • match

        public <R> R match​(java.util.function.BiFunction<A,​A,​R> cases)
        Function to use for comparison of two equal elements
        Type Parameters:
        R - result type
        Parameters:
        cases - a BiFunction taking two values of this equality class
        Returns:
        a R object.
      • lhs

        public A lhs()
        Access the left element
        Returns:
        left hand side,
      • rhs

        public A rhs()
        Access the right element
        Returns:
        right hand side,
      • isEq

        public static <A> IsEq<A> isEq​(A lhs,
                                       A rhs)
        Two equal elements
        Type Parameters:
        A - equality type
        Parameters:
        lhs - an A
        rhs - an A
        Returns:
        a IsEq instance