local numbers = _objectWrappers:wrap(_arrays:arrayOf(_plugins:loadClass("java.lang.Integer"), 1, 2, 3, 4, 5)) -- 计算累积索引加权和,累积索引加权和: [0, 1, 5, 14, 30, 55] numbers:scanIndexed(0, function(index, acc, element) return acc + element * (index + 1) end) :forEach(function(it) _console:log(it) end)