sort
val numbers = arrayOf(5, 2, 4, 1, 3)
// 对数组进行排序
numbers.sort(0, numbers.count())
// 排序后的数组: [1, 2, 3, 4, 5]
numbers.forEach {
_console.log(it)
}
def numbers = $objectWrappers.wrap($arrays.arrayOf($plugins.loadClass("java.lang.Integer"), 5, 2, 4, 1, 3))
// 对数组进行排序
numbers.sort(0, numbers.count())
// 排序后的数组: [1, 2, 3, 4, 5]
numbers.forEach {
$console.log(it)
}
let numbers = $objectWrappers.wrap($arrays.arrayOf($plugins.loadClass("java.lang.Integer"), 5, 2, 4, 1, 3))
// 对数组进行排序
numbers.sort(0, numbers.count())
// 排序后的数组: [1, 2, 3, 4, 5]
numbers.forEach((it) => {
$console.log(it)
})
local numbers = _objectWrappers:wrap(_arrays:arrayOf(_plugins:loadClass("java.lang.Integer"), 5, 2, 4, 1, 3))
-- 对数组进行排序
numbers:sort(0, numbers:count())
-- 排序后的数组: [1, 2, 3, 4, 5]
numbers:forEach(function(it)
_console:log(it)
end)
<?php
$numbers = $objectWrappers->wrap($arrays->arrayOf($plugins->loadClass("java.lang.Long"), 5, 2, 4, 1, 3));
// 对数组进行排序
$numbers->sort(0, $numbers->count());
// 排序后的数组: [1, 2, 3, 4, 5]
$numbers->forEach(function ($it) use ($console) {
$console->log($it);
});
numbers = _objectWrappers.wrap(_arrays.arrayOf(_plugins.loadClass("java.lang.Long"), 5, 2, 4, 1, 3))
# 对数组进行排序
numbers.sort(0, numbers.count())
# 排序后的数组: [1, 2, 3, 4, 5]
numbers.forEach(lambda it: _console.log(it))
# encoding: utf-8
numbers = $objectWrappers.wrap($arrays.arrayOf($plugins.loadClass("java.lang.Long"), 5, 2, 4, 1, 3))
# 对数组进行排序
numbers.sort(0, numbers.count())
# 排序后的数组: [1, 2, 3, 4, 5]
numbers.forEach { |it|
$console.log(it)
}
Last modified: 29 April 2025