@Override
    protected E map(final Traverser.Admin<S> traverser) {
        final S item = traverser.get();

        if (null == item) {
            // we will pass null lists to next step
            return null;
        } else if ((item instanceof Iterable) || (item instanceof Iterator) || item.getClass().isArray()) {
            final List<String> resList = new ArrayList<>();
            final Iterator<E> iterator = IteratorUtils.asIterator(item);
            while (iterator.hasNext()) {
                final E i = iterator.next();
                resList.add((i == null) ? null : String.valueOf(i));
            }
            return (E) resList;
        } else {
            return (E) String.valueOf(item);
        }
    }
Reference implementation for asString() step, a mid-traversal step which returns the incoming traverser value
as a string. Null values are returned unchanged.

@author David Bechberger (http://bechberger.com)
@author Yang Xia (http://github.com/xiazcy)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsStringLocalStep.java