@Test
    public void g_V_call_streaming_lambda() {
        final String serviceName = "tinker.xerox";

        final TriFunction<ServiceCallContext, Traverser.Admin<Object>,Map,Iterator<Object>> lambda = (ctx, traverser, map) -> {
            final int numCopies = (int) map.getOrDefault("numCopies", 2);
            if (ctx.getTraversal().getTraverserRequirements().contains(TraverserRequirement.BULK)) {
                traverser.setBulk(traverser.bulk() * numCopies);
                return IteratorUtils.of(traverser);
            } else {
                return IntStream.range(0, numCopies).mapToObj(i -> traverser.get()).iterator();
            }
        };

        graph.getServiceRegistry().registerLambdaService(serviceName).addStreamingLambda(lambda);

        checkResult(6l,
            g.V().count());

        checkResult(12l,
            g.V().call(serviceName).count());

        checkResult(18l,
            g.V().call(serviceName).with("numCopies", 3).count());
    }
Demonstrates registration and usage of a Streaming lambda service. Streaming services produce an iterator
of results for each upstream input.
tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphServiceTest.java