words = _objectWrappers.wrap(_arrays.arrayOf(_plugins.loadClass("java.lang.String"), "hello", "world", "kotlin")) # 打印每个单词及其索引,并返回原始数组 result = words.onEachIndexed(lambda index, word: _console.log("Index: ", index, "Word: ", word)) # 输出:结果: [Ljava.lang.String;@... _console.log("结果: ", result) # 同时打印: # Index: 0, Word: hello # Index: 1, Word: world # Index: 2, Word: kotlin