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

        final Map mapA = (incoming instanceof Map) ? (Map) incoming : null;
        if (mapA != null) {
            final Object mapB = (valueTraversal != null) ? TraversalUtil.apply(traverser, valueTraversal) : parameterItems.get();
            if (!(mapB instanceof Map)) {
                throw new IllegalArgumentException(
                        String.format(
                                "%s step expected provided argument to evaluate to a Map, encountered %s",
                                getStepName(),
                                mapB.getClass()));
            }

            final Map mergedMap = new HashMap(mapA);
            mergedMap.putAll((Map) mapB);
            return (E) mergedMap;
        } else {
            final Collection listA = convertTraverserToCollection(traverser);

            if (parameterItems != null && parameterItems.get() instanceof Map) {
                throw new IllegalArgumentException(getStepName() + " step type mismatch: expected argument to be Iterable but got Map");
            }
            final Collection listB =
                    (null != valueTraversal)
                            ? convertTraversalToCollection(traverser, valueTraversal)
                            : convertArgumentToCollection(parameterItems.get());

            final Set elements = new HashSet();

            elements.addAll(listA);
            elements.addAll(listB);

            return (E) elements;
        }
    }
A map step that returns the merger of the traverser and the provided arguments without duplicates. This is commonly
known as a union.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MergeStep.java