@Override
        public boolean terminate(final Memory memory) {
            final TraverserGenerator generator = this.traversal.get().getTraverserGenerator();
            MemoryTraversalSideEffects.setMemorySideEffects(this.traversal.get(), memory, ProgramPhase.TERMINATE);
            checkSideEffects();
            if (memory.isInitialIteration()) {
                assertFalse(memory.exists(TraversalVertexProgram.HALTED_TRAVERSERS));
                return false;
            } else {
                ///
                assertTrue(memory.exists(TraversalVertexProgram.HALTED_TRAVERSERS));
                final TraverserSet<String> haltedTraversers = memory.get(TraversalVertexProgram.HALTED_TRAVERSERS);
                haltedTraversers.add(generator.generate("hello", this.programStep, 1l));
                haltedTraversers.add(generator.generate("gremlin", this.programStep, 1l));
                memory.set(TraversalVertexProgram.HALTED_TRAVERSERS, haltedTraversers);
                return true;
            }
        }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProgramTest.java