Trace { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } else if (obj instanceof Trace) { final Trace<?, ?> that = (Trace<?, ?>) obj; return this.states.equals(that.states) && this.actions.equals(that.actions); } else { return false; } } private  Trace(final List<? extends S> states, final List<? extends A> actions); static Trace<S, A> of(final List<? extends S> states, final List<? extends A> actions); int length(); S getState(final int i); A getAction(final int i); List<S> getStates(); List<A> getActions(); Trace<S, A> reverse(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString();  }
@Test public void testEquals() { final Trace<?, ?> trace1 = Trace.of(of(s0, s1, s2), of(a0, a1)); final Trace<?, ?> trace2 = Trace.of(of(s0, s1, s2), of(a0, a1)); final Trace<?, ?> trace3 = Trace.of(of(s0, s2, s1), of(a0, a1)); final Trace<?, ?> trace4 = Trace.of(of(s0, s1, s2), of(a1, a0)); Assert.assertTrue(trace1.equals(trace2)); Assert.assertFalse(trace1.equals(trace3)); Assert.assertFalse(trace1.equals(trace4)); }