Golo doesn’t have an instantiation operator like new in Java. Instead, creating an object and
calling its constructor is done as if it was just another function.
As an example, we may allocate a java.util.LinkedList as follows:
module sample
import java.util
function aList = {
return LinkedList()
}Another example would be using a java.lang.StringBuilder.
function str_build = {
return java.lang.StringBuilder("h"):
append("e"):
append("l"):
append("l"):
append("o"):
toString()
}As one would expect, the str_build function above gives the "hello" string.