@Test public void testEquals() { Match<String> m1 = Match.any(); Match<String> m2 = Match.any(); Match<String> m3 = Match.ifNull(); Match<String> m4 = Match.ifValue("bar"); assertEquals(m1, m2); assertFalse(Objects.equal(m1, m3)); assertFalse(Objects.equal(m3, m4)); }
@Override public boolean equals(Object other) { if (!(other instanceof Match)) { return false; } Match<T> that = (Match<T>) other; return this.matchAny == that.matchAny && Objects.equals(this.value, that.value) && this.negation == that.negation; }
Match { @Override public boolean equals(Object other) { if (!(other instanceof Match)) { return false; } Match<T> that = (Match<T>) other; return this.matchAny == that.matchAny && Objects.equals(this.value, that.value) && this.negation == that.negation; } }
Match { @Override public boolean equals(Object other) { if (!(other instanceof Match)) { return false; } Match<T> that = (Match<T>) other; return this.matchAny == that.matchAny && Objects.equals(this.value, that.value) && this.negation == that.negation; } private  Match(); private  Match(T value, boolean negation); }
Match { @Override public boolean equals(Object other) { if (!(other instanceof Match)) { return false; } Match<T> that = (Match<T>) other; return this.matchAny == that.matchAny && Objects.equals(this.value, that.value) && this.negation == that.negation; } private  Match(); private  Match(T value, boolean negation); static Match<T> any(); static Match<T> ifNull(); static Match<T> ifNotNull(); static Match<T> ifValue(T value); static Match<T> ifNotValue(T value); Match<V> map(Function<T, V> mapper); boolean matches(T other); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString(); }
Match { @Override public boolean equals(Object other) { if (!(other instanceof Match)) { return false; } Match<T> that = (Match<T>) other; return this.matchAny == that.matchAny && Objects.equals(this.value, that.value) && this.negation == that.negation; } private  Match(); private  Match(T value, boolean negation); static Match<T> any(); static Match<T> ifNull(); static Match<T> ifNotNull(); static Match<T> ifValue(T value); static Match<T> ifNotValue(T value); Match<V> map(Function<T, V> mapper); boolean matches(T other); @Override int hashCode(); @Override boolean equals(Object other); @Override String toString(); static final Match ANY; static final Match NULL; static final Match NOT_NULL; }