static <S> S applyRange(final S start, final long low, final long high) {
        if (start instanceof Map) {
            return (S) applyRangeMap((Map) start, low, high);
        } else if (start instanceof Iterable) {
            return (S) applyRangeIterable((Iterable) start, low, high);
        } else if (start != null && start.getClass().isArray()) {
            return (S) applyRangeIterable(IteratorUtils.asList(start), low, high);
        }
        return start;
    }
Extracts the specified range of elements from a collection.
Return type depends on dynamic type of start.
<ul>
<li>
Map becomes Map (order-preserving)
</li>
<li>
Set becomes Set (order-preserving)
</li>
<li>
Other Collection types become List
</li>
</ul>
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/RangeLocalStep.java