@Test public void someEquivalenceSet() { EquivalenceFinder<Integer> finder = create(); finder.markEquivalent(1, 2); finder.markEquivalent(2, 3); checkEquivalents(1, finder, 2, 3); }
public void markEquivalent(T one, T two) { ArgumentValidation.notNull("first arg", one); ArgumentValidation.notNull("second arg", two); if (one.equals(two)) return; equivalences.put(one, two); equivalences.put(two, one); }
EquivalenceFinder { public void markEquivalent(T one, T two) { ArgumentValidation.notNull("first arg", one); ArgumentValidation.notNull("second arg", two); if (one.equals(two)) return; equivalences.put(one, two); equivalences.put(two, one); } }
EquivalenceFinder { public void markEquivalent(T one, T two) { ArgumentValidation.notNull("first arg", one); ArgumentValidation.notNull("second arg", two); if (one.equals(two)) return; equivalences.put(one, two); equivalences.put(two, one); } EquivalenceFinder();   EquivalenceFinder(int maxTraversals); }
EquivalenceFinder { public void markEquivalent(T one, T two) { ArgumentValidation.notNull("first arg", one); ArgumentValidation.notNull("second arg", two); if (one.equals(two)) return; equivalences.put(one, two); equivalences.put(two, one); } EquivalenceFinder();   EquivalenceFinder(int maxTraversals); void copyEquivalences(EquivalenceFinder<? extends T> source); void markEquivalent(T one, T two); boolean areEquivalent(T one, T two); Set<T> findEquivalents(T node); Set<Entry<T, T>> equivalencePairs(); Set<T> findParticipants(); @Override String toString(); }
EquivalenceFinder { public void markEquivalent(T one, T two) { ArgumentValidation.notNull("first arg", one); ArgumentValidation.notNull("second arg", two); if (one.equals(two)) return; equivalences.put(one, two); equivalences.put(two, one); } EquivalenceFinder();   EquivalenceFinder(int maxTraversals); void copyEquivalences(EquivalenceFinder<? extends T> source); void markEquivalent(T one, T two); boolean areEquivalent(T one, T two); Set<T> findEquivalents(T node); Set<Entry<T, T>> equivalencePairs(); Set<T> findParticipants(); @Override String toString();  }