I am currently create a Pipe as shown in line 2 below.
Pipe pipe = Gremlin.compile("_().out('knows').name");
After it has been created I am caching it so that it can be re-used with different graphs below
Graph graph = TinkerGraphFactory.createTinkerGraph();
pipe.setStarts(new SingleIterator<Vertex>(graph.getVertex(1)));
for(Object name : pipe)
{
System.out.println((String) name);
}
I am wondering if this is alright? I ask because the javadoc of AbstractPipe says
public void reset()
Description copied from interface: Pipe
A pipe may maintain state. Reset is used to remove state. The general use case for reset() is to reuse a pipe in another computation without having to create a new Pipe object. An implementation of this method should be recursive whereby the starts (if a Pipe) should have this method called on it.
Specified by:
reset in interface Pipe<S,E>