@Test @DisplayName("support equality") void supportEquality() { StringValue v1 = TestValues.newUuidValue(); StringValue v2 = TestValues.newUuidValue(); Pair<StringValue, StringValue> p1 = Pair.of(v1, v2); Pair<StringValue, StringValue> p1a = Pair.of(v1, v2); Pair<StringValue, StringValue> p2 = Pair.of(v2, v1); new EqualsTester().addEqualityGroup(p1, p1a) .addEqualityGroup(p2) .testEquals(); }
public static <A extends Message, B extends Message> Pair<A, B> of(A a, B b) { A safeA = checkNotNullOrEmpty(a); B safeB = checkNotNullOrEmpty(b); Pair<A, B> result = new Pair<>(safeA, safeB); return result; }
Pair extends Tuple implements AValue<A>, BValue<B> { public static <A extends Message, B extends Message> Pair<A, B> of(A a, B b) { A safeA = checkNotNullOrEmpty(a); B safeB = checkNotNullOrEmpty(b); Pair<A, B> result = new Pair<>(safeA, safeB); return result; } }
Pair extends Tuple implements AValue<A>, BValue<B> { public static <A extends Message, B extends Message> Pair<A, B> of(A a, B b) { A safeA = checkNotNullOrEmpty(a); B safeB = checkNotNullOrEmpty(b); Pair<A, B> result = new Pair<>(safeA, safeB); return result; } private  Pair(A a, B b); }
Pair extends Tuple implements AValue<A>, BValue<B> { public static <A extends Message, B extends Message> Pair<A, B> of(A a, B b) { A safeA = checkNotNullOrEmpty(a); B safeB = checkNotNullOrEmpty(b); Pair<A, B> result = new Pair<>(safeA, safeB); return result; } private  Pair(A a, B b); static Pair<A, B> of(A a, B b); static Pair<A, Optional<B>> withNullable(A a, @Nullable B b); static Pair<A, Optional<B>> withOptional(
            A a,
            @SuppressWarnings("OptionalUsedAsFieldOrParameterType") /* see @apiNote */ Optional<B> b
    ); static Pair<A, B> withEither(A a, B b); @Override A getA(); @Override B getB(); }
Pair extends Tuple implements AValue<A>, BValue<B> { public static <A extends Message, B extends Message> Pair<A, B> of(A a, B b) { A safeA = checkNotNullOrEmpty(a); B safeB = checkNotNullOrEmpty(b); Pair<A, B> result = new Pair<>(safeA, safeB); return result; } private  Pair(A a, B b); static Pair<A, B> of(A a, B b); static Pair<A, Optional<B>> withNullable(A a, @Nullable B b); static Pair<A, Optional<B>> withOptional(
            A a,
            @SuppressWarnings("OptionalUsedAsFieldOrParameterType") /* see @apiNote */ Optional<B> b
    ); static Pair<A, B> withEither(A a, B b); @Override A getA(); @Override B getB();  }