DefaultValueMapTraversal implements ValueMapTraversal { @Override public long count() { return flow.apply(supplier.get()).count().tryNext().orElse(0L); } DefaultValueMapTraversal(Supplier<GraphTraversal<?, ?>> supplier, Function<GraphTraversal<?, ?>,
            GraphTraversal<Vertex, Map<String, Object>>> flow); @Override Stream<Map<String, Object>> stream(); @Override Stream<Map<String, Object>> next(int limit); @Override Map<String, Object> next(); @Override Optional<Map<String, Object>> getSingleResult(); @Override List<Map<String, Object>> getResultList(); @Override long count();  }
@Test public void shouldCount() { long count = graphTemplate.getTraversalVertex() .hasLabel(Person.class).valueMap("name").count(); assertEquals(3L, count); }