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

        // we will pass null values to next step
        return (E) getTrimmedString((String) item, false, true);
    }
Reference implementation for rTrim() step, a mid-traversal step which a string with trailing
whitespace removed. Null values are not processed and remain as null when returned.
If the incoming traverser is a non-String value then an {@code IllegalArgumentException} will be thrown.

@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/RTrimGlobalStep.java