胡子能在java地图上循环吗?我的目标:
Map<Integer, String> mapTest在我的胡子模板里试过这个:
{{#mapTest}}
{{.}}
{{/mapTest}}这会产生整个对象的字符串表示形式(mapTest.toString()),但根本不循环。
更新:在搜索源的过程中,我越来越接近了,但仍然不知道该如何做。https://github.com/scalate/scalate/blob/ec981338c067fcf37106fb5f3bdf2fa8c4e458ca/scalate-core/src/main/scala/org/fusesource/scalate/mustache/Scope.scala#L124-125
发布于 2011-01-20 15:02:11
看邮件列表上的答案..。
http://groups.google.com/group/scalate/msg/100df004001d84f0
发布于 2020-12-22 03:11:34
你可以convert the Java Map to a Scala Map。
import scala.collection.JavaConverters._
val myScalaMap = myJavaMap.asScala.mapValues(_.asScala.toSet)我不会黑这个模板来容纳一个Java对象。
https://stackoverflow.com/questions/4741180
复制相似问题