in src/main/java/org/apache/sling/scripting/sightly/compiler/util/ObjectModel.java [341:354]
public static Object getIndex(Object object, int index) {
if (object == null) {
return null;
}
Class<?> cls = object.getClass();
if (cls.isArray() && index >= 0 && index < Array.getLength(object)) {
return Array.get(object, index);
}
Collection collection = toCollection(object);
if (collection instanceof List && index >= 0 && index < collection.size()) {
return ((List) collection).get(index);
}
return null;
}