1

If it is possible what would be the easiest way of adding an element to a scala ListBuffer from within java.

this is the scala ListBuffer (in scala)

var newModVersion: ListBuffer[NewModVersionEntry] = new ListBuffer[NewModVersionEntry]()

and this is what I want to add (in java)

XplosionCoreBL.newModVersion().add(new NewModVersionEntry(name, latestVersion, latestMCVersion, isCritical, description));

2 Answers 2

2
XplosionCoreBL.newModVersion().$plus$eq(new NewModVersionEntry(name, latestVersion, latestMCVersion, isCritical, description));

In Java, $plus$eq corresponds to the += (append single element) method of ListBuffer.

Sign up to request clarification or add additional context in comments.

Comments

0
List<NewModVersionEntry> asJavaList = scala.collection.JavaConversions.bufferAsJavaList(XplosionCoreBL.newModVersion());
asJavaList.add(new NewModVersionEntry(name, latestVersion, latestMCVersion, isCritical, description));

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.