M8Test Help

mutableMapOf

val m = mutableMapOf(1 to "A", 2 to "B") // 可变 Map 可以修改 m.put(3, "C") m.put(4, "D") m.put(5, "E") m.forEach { _console.log(it) }
def m = $maps.mutableMapOf($maps.pairOf(1, "A"), $maps.pairOf(2, "B")) // 可变 Map 可以修改 m.put(3, "C") m.put(4, "D") m.put(5, "E") $objectWrappers.wrap(m).forEach { $console.log(it) }
let m = $maps.mutableMapOf($maps.pairOf(1, "A"), $maps.pairOf(2, "B")) // 可变 Map 可以修改 m.put(3, "C") m.put(4, "D") m.put(5, "E") $objectWrappers.wrap(m).forEach((it) => { $console.log(it) })
local m = _maps:mutableMapOf(_maps:pairOf(1, "A"), _maps:pairOf(2, "B")) -- 可变 Map 可以修改 m:put(3, "C") m:put(4, "D") m:put(5, "E") _objectWrappers:wrap(m):forEach(function(it) _console:log(it) end)
<?php $m = $maps->mutableMapOf($maps->pairOf(1, "A"), $maps->pairOf(2, "B")); // 可变 Map 可以修改 $m->put(3, "C"); $m->put(4, "D"); $m->put(5, "E"); $objectWrappers->wrap($m)->forEach(function ($it) use ($console) { $console->log($it); });
m = _maps.mutableMapOf(_maps.pairOf(1, "A"), _maps.pairOf(2, "B")) # 可变 Map 可以修改 m.put(3, "C") m.put(4, "D") m.put(5, "E") def fn(it): _console.log(it) _objectWrappers.wrap(m).forEach(fn)
m = $maps.mutableMapOf($maps.pairOf(1, "A"), $maps.pairOf(2, "B")) # 可变 Map 可以修改 m.put(3, "C") m.put(4, "D") m.put(5, "E") $objectWrappers.wrap(m).forEach { |it| $console.log(it) }
Last modified: 29 April 2025