local numbers = _objectWrappers:wrap(_arrays:newArray(_plugins:loadClass("java.lang.Integer"), 5)) -- 使用值 10 填充数组的索引0-3所有元素 numbers:fill(10, 0, 3) -- 填充后的数组: [10, 10, 10, nil, nil] numbers:forEachIndexed(function(index, element) _console:log(index, element) end) -- 创建一个大小为 5 的字符串数组,并使用 "hello" 填充 local strings = _objectWrappers:wrap(_arrays:newArray(_plugins:loadClass("java.lang.String"), 5)) strings:fill("hello", 0, 3) -- 字符串数组: [hello, hello, hello, nil, nil] strings:forEachIndexed(function(index, element) _console:log(index, element) end)