M8Test Help

minOf

val numbers = arrayOf(10, 20, 30, 5, 15) // 查找数组中的最小值 val minValue = numbers.minOf { it } // 输出:最小值: 5 _console.log("最小值: ", minValue)
def numbers = $objectWrappers.wrap($arrays.arrayOf($plugins.loadClass("java.lang.Integer"), 10, 20, 30, 5, 15)) // 查找数组中的最小值 def minValue = numbers.minOf { it } // 输出:最小值: 5 $console.log("最小值: ", minValue)
let numbers = $objectWrappers.wrap($arrays.arrayOf($plugins.loadClass("java.lang.Integer"), 10, 20, 30, 5, 15)) // 查找数组中的最小值 let minValue = numbers.minOf(it => it) // 输出:最小值: 5 $console.log("最小值: ", minValue)
local numbers = _objectWrappers:wrap(_arrays:arrayOf(_plugins:loadClass("java.lang.Integer"), 10, 20, 30, 5, 15)) -- 查找数组中的最小值 local minValue = numbers:minOf(function(it) return it end) -- 输出:最小值: 5 _console:log("最小值: ", minValue)
<?php $numbers = $objectWrappers->wrap($arrays->arrayOf($plugins->loadClass("java.lang.Long"), 10, 20, 30, 5, 15)); // 查找数组中的最小值 $minValue = $numbers->minOf(function ($it) { return $it; }); // 输出:最小值: 5 $console->log("最小值: ", $minValue);
numbers = _objectWrappers.wrap(_arrays.arrayOf(_plugins.loadClass("java.lang.Long"), 10, 20, 30, 5, 15)) # 查找数组中的最小值 minValue = numbers.minOf(lambda it: it) # 输出:最小值: 5 _console.log("最小值: ", minValue)
# encoding: utf-8 numbers = $objectWrappers.wrap($arrays.arrayOf($plugins.loadClass("java.lang.Long"), 10, 20, 30, 5, 15)) # 查找数组中的最小值 minValue = numbers.minOf { |it| it } # 输出:最小值: 5 $console.log("最小值: ", minValue)
Last modified: 09 September 2025