You can use the following API to create a Java ArrayList.
 

	public static ArrayList<Object> createList() {
	...
	} 

	public static ArrayList<Object> createList(Object object) {
	...
	}


A Java List will be required under certain circumstances, e.g., if you want to create Argument values that will be passed to some calling Behaviors or operations. In scripting languages, the built-in functions importPackage and importClass can be used to import the Java packages and Classes.

The following code fragment shows how to create a Java ArrayList in the scripting language using a "new" operator

importPackage(java.util);
arguments = new ArrayList();
arguments.add("value1");

 

The following code fragment shows how to create the Java ArrayList in the scripting language with ALH

arguments = ALH.createList();
arguemnts.add("value1");

 

Alternatively, you can use an initial value as the constructor's parameter.

arguments = ALH.createList("value1");

Note

  • Only one initial value of the list is allowed.
  • Variable-length argument lists are not supported.