Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
不知道是否可以将元素从一个地图以速度复制到另一张地图?这只复制最后一个元素
#foreach($key in $departamentsMap.keySet()) $key - $departamentsMap.get($key) #set($maap={$key:$departamentsMap.get($key)} ) #end
那是因为你每次都在创建一个新的 $maap。做就是了:
#set( $map = {} ) #set( $ignore = $map.putAll($departamentsMap) )
它只是下面的一个HashMap。不复杂。:)