# encoding: utf-8 words = $objectWrappers.wrap($arrays.arrayOf($plugins.loadClass("java.lang.String"), "hello", "world", "kotlin")) # 将每个单词转换为带索引的字符串, 带索引的单词: [0: hello, 1: world, 2: kotlin] words.mapIndexed { |index, word| index.to_s + ": " + word }.forEach { |it| $console.log(it) }