@Test public void testHashCode() { DependencyTraverser other1 = new DummyDependencyTraverser( true ); DependencyTraverser other2 = new DummyDependencyTraverser( false ); DependencyTraverser traverser1 = new AndDependencyTraverser( other1, other2 ); DependencyTraverser traverser2 = new AndDependencyTraverser( other2, other1 ); assertEquals( traverser1.hashCode(), traverser2.hashCode() ); }
@Override public int hashCode() { if ( hashCode == 0 ) { int hash = 17; hash = hash * 31 + traversers.hashCode(); hashCode = hash; } return hashCode; }
AndDependencyTraverser implements DependencyTraverser { @Override public int hashCode() { if ( hashCode == 0 ) { int hash = 17; hash = hash * 31 + traversers.hashCode(); hashCode = hash; } return hashCode; } }
AndDependencyTraverser implements DependencyTraverser { @Override public int hashCode() { if ( hashCode == 0 ) { int hash = 17; hash = hash * 31 + traversers.hashCode(); hashCode = hash; } return hashCode; } AndDependencyTraverser( DependencyTraverser... traversers );  AndDependencyTraverser( Collection<? extends DependencyTraverser> traversers ); private  AndDependencyTraverser( Set<DependencyTraverser> traversers ); }
AndDependencyTraverser implements DependencyTraverser { @Override public int hashCode() { if ( hashCode == 0 ) { int hash = 17; hash = hash * 31 + traversers.hashCode(); hashCode = hash; } return hashCode; } AndDependencyTraverser( DependencyTraverser... traversers );  AndDependencyTraverser( Collection<? extends DependencyTraverser> traversers ); private  AndDependencyTraverser( Set<DependencyTraverser> traversers ); static DependencyTraverser newInstance( DependencyTraverser traverser1, DependencyTraverser traverser2 ); boolean traverseDependency( Dependency dependency ); DependencyTraverser deriveChildTraverser( DependencyCollectionContext context ); @Override boolean equals( Object obj ); @Override int hashCode(); }
AndDependencyTraverser implements DependencyTraverser { @Override public int hashCode() { if ( hashCode == 0 ) { int hash = 17; hash = hash * 31 + traversers.hashCode(); hashCode = hash; } return hashCode; } AndDependencyTraverser( DependencyTraverser... traversers );  AndDependencyTraverser( Collection<? extends DependencyTraverser> traversers ); private  AndDependencyTraverser( Set<DependencyTraverser> traversers ); static DependencyTraverser newInstance( DependencyTraverser traverser1, DependencyTraverser traverser2 ); boolean traverseDependency( Dependency dependency ); DependencyTraverser deriveChildTraverser( DependencyCollectionContext context ); @Override boolean equals( Object obj ); @Override int hashCode();  }