# encoding: utf-8 dw = $objectWrappers.wrap($iterables.mutableListOf()) data = $objectWrappers.wrap($arrays.arrayOf($plugins.loadClass("java.lang.String"), "one", nil, "three", "four", nil)) # 将非空字符串转换为其长度, 非空字符串长度: [3, 5, 4] data.mapNotNullTo(dw) { |it| if it != nil then $objectWrappers.wrap(it).count() else nil end }.forEach { |it| $console.log(it) }