如果可能的话,最简单的方法是从java中向scala ListBuffer添加元素。
这是scala ListBuffer(在scala中)
var newModVersion: ListBuffer[NewModVersionEntry] = new ListBuffer[NewModVersionEntry]()
这就是我要添加的内容(在java中)
XplosionCoreBL.newModVersion().add(new NewModVersionEntry(name, latestVersion, latestMCVersion, isCritical, description));
答案 0 :(得分:1)
XplosionCoreBL.newModVersion().$plus$eq(new NewModVersionEntry(name, latestVersion, latestMCVersion, isCritical, description));
在Java中,$plus$eq
对应+=
(append single element) method of ListBuffer
。
答案 1 :(得分:0)
List<NewModVersionEntry> asJavaList = scala.collection.JavaConversions.bufferAsJavaList(XplosionCoreBL.newModVersion());
asJavaList.add(new NewModVersionEntry(name, latestVersion, latestMCVersion, isCritical, description));