private Map<String, Object> getMapOfSideEffects() {
        final TraversalSideEffects temp = this.getTraversal().getSideEffects();
        final Map<String, Object> sideEffects = new HashMap<>();
        for (final String sideEffectKey : this.sideEffectKeys) {
            if (temp.exists(sideEffectKey)) {
                final E result = temp.get(sideEffectKey);
                final SideEffectCapable<Object, E> sideEffectCapable = this.sideEffectCapableSteps.get(sideEffectKey);
                final E finalResult = null == sideEffectCapable ? result : sideEffectCapable.generateFinalResult(result);
                temp.set(sideEffectKey, finalResult);
                sideEffects.put(sideEffectKey, finalResult);
            }
        }
        return sideEffects;
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SideEffectCapStep.java