@Test public void getBuildChainOnIsolatedVerticesShouldReturnSameOrder() { DependencyGraph<Commit> graph = new DependencyGraph<>(m -> Optional.empty()); ImmutableList<Commit> isolatedMailboxes = ImmutableList.of(new Commit("A"), new Commit("B"), new Commit("C")); isolatedMailboxes.forEach(graph::registerItem); List<Commit> orderedResultList = graph.getBuildChain().collect(Collectors.toList()); assertThat(orderedResultList).isEqualTo(isolatedMailboxes); }
public Stream<T> getBuildChain() throws CycleDetectedException { DefaultDirectedGraph<T, DefaultEdge> graph = builder.build(); ensureNoCycle(graph); return Iterators.toStream(new TopologicalOrderIterator<>(graph)); }
DependencyGraph { public Stream<T> getBuildChain() throws CycleDetectedException { DefaultDirectedGraph<T, DefaultEdge> graph = builder.build(); ensureNoCycle(graph); return Iterators.toStream(new TopologicalOrderIterator<>(graph)); } }
DependencyGraph { public Stream<T> getBuildChain() throws CycleDetectedException { DefaultDirectedGraph<T, DefaultEdge> graph = builder.build(); ensureNoCycle(graph); return Iterators.toStream(new TopologicalOrderIterator<>(graph)); } DependencyGraph(Function<T, Optional<T>> getParent); }
DependencyGraph { public Stream<T> getBuildChain() throws CycleDetectedException { DefaultDirectedGraph<T, DefaultEdge> graph = builder.build(); ensureNoCycle(graph); return Iterators.toStream(new TopologicalOrderIterator<>(graph)); } DependencyGraph(Function<T, Optional<T>> getParent); void registerItem(T item); Stream<T> getBuildChain(); String toString(); }
DependencyGraph { public Stream<T> getBuildChain() throws CycleDetectedException { DefaultDirectedGraph<T, DefaultEdge> graph = builder.build(); ensureNoCycle(graph); return Iterators.toStream(new TopologicalOrderIterator<>(graph)); } DependencyGraph(Function<T, Optional<T>> getParent); void registerItem(T item); Stream<T> getBuildChain(); String toString();  }