[ https://issues.apache.org/jira/browse/TINKERPOP-1822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16437370#comment-16437370 ]
ASF GitHub Bot commented on TINKERPOP-1822: ------------------------------------------- Github user robertdale commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/838#discussion_r181408164 --- Diff: gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java --- @@ -273,11 +314,37 @@ public RepeatEndStep(final Traversal.Admin traversal) { super(traversal); } + final LinkedList<Traverser.Admin<S>> stashedStarts = new LinkedList<>(); + + private Traverser.Admin<S> nextStart(RepeatStep<S> repeatStep) { + if (repeatStep.searchAlgo.equals(SearchAlgo.BFS)) { + return this.starts.next(); + } else { + if (this.starts.hasNext()) { + return this.starts.next(); + } else { + return this.stashedStarts.pop(); + } + } + } + + @Override + public boolean hasNext() { + return super.hasNext() || this.stashedStarts.peek() != null; --- End diff -- `this.stashedStarts.peek() != null` would be equivalent to `!this.stashedStarts.isEmpty()`, no? > Repeat should depth first search > -------------------------------- > > Key: TINKERPOP-1822 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1822 > Project: TinkerPop > Issue Type: Improvement > Components: process > Affects Versions: 3.3.0, 3.2.6 > Reporter: Robert Dale > Priority: Major > > Perhaps optionally. > See also: > * https://groups.google.com/forum/#!topic/gremlin-users/gLSLxH_K-wE > * https://github.com/apache/tinkerpop/pull/715 -- This message was sent by Atlassian JIRA (v7.6.3#76005)