@Override
    protected String map(final Traverser.Admin<S> traverser) {
        // throws when incoming traverser isn't a string
        if (null != traverser.get() && !(traverser.get() instanceof String)) {
            throw new IllegalArgumentException(
                    String.format("String concat() can only take string as argument, encountered %s", traverser.get().getClass()));
        }

        final StringBuilder sb = new StringBuilder();
        // all null values are skipped during appending, as StringBuilder will otherwise append "null" as a string
        if (null != traverser.get()) {
            // we know there is one non-null part in the string we concat
            this.isNullTraverser = false;
            sb.append(traverser.get());
        }

        if (null != this.concatTraversals) {
            this.concatTraversals.forEach(ct -> {
                final String result = TraversalUtil.apply(traverser, ct);
                if (null != result) {
                    this.isNullTraversal = false;
                    sb.append(result);
                }
            });
        }

        if (!this.isNullString) {
            sb.append(this.stringArgsResult);
        }

        if (this.isNullTraverser && this.isNullTraversal && this.isNullString) {
            return null;
        } else {
            this.isNullTraverser = true;
            this.isNullTraversal = true;
            return sb.toString();
        }
    }
Reference implementation for String concatenation step, a mid-traversal step which concatenates one or more
String values together to the incoming String traverser. If the incoming traverser is a non-String value then an
{@code IllegalArgumentException} will be thrown.

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