@Override
    protected S map(final Traverser.Admin<S> traverser) {
        final S start = traverser.get();
        if (start instanceof Map) {
            return mapMap((Map) start);
        } else if (start instanceof Collection) {
            return mapCollection((Collection) start);
        } else if (start != null && start.getClass().isArray()) {
            return mapCollection(IteratorUtils.asList(start));
        }
        return start;
    }
@author Daniel Kuppitz (http://gremlin.guru)
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SampleLocalStep.java