Create instances of java class using Groovy script
问题 I am using Groovy script and Java, I am new to the subject. I am trying to create multiple instances of a java class (A) from groovy script and pass them to list, then pass this list to a new class (B). my B java file is: public class B { public void getValues(List<A> values) {...} } my A java file is: public class A { public long num; public A(long num){ this.num = num; } } my main java files is: GroovyScriptEngine groovyScriptEngine = new GroovyScriptEngine(/*path to file.groovy*/); Binding