create a new List - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Programming : OpenMaple : Java Application Programming Interface : Engine Class : OpenMaple/Java/Engine/newList

Engine.newList - create a new List

Calling Sequence

List newList( int length ) throws MapleException




length of the list to be created



The newList method creates a new Maple list of length length.  The list is represented as a List object.


The elements of the list must be initialized and the unique member function must be called before it can be passed into a Java OpenMaple function.


Errors that occur within the Maple session are reported via errorCallBack, other errors are raised as a MapleException.


import com.maplesoft.openmaple.*;

import com.maplesoft.externalcall.MapleException;

class Example


    public static void main( String notused[] ) throws MapleException


    String mapleArgs[];

    Engine engine;

    List l;

    mapleArgs = new String[1];

    mapleArgs[0] = "java";

    engine = new Engine( mapleArgs, new EngineCallBacksDefault(),

        null, null );

    l = (List)engine.newList( 3 );

    l.assign( 1, engine.newNumeric( 12345 ) );

    l.assign( 2, engine.newNumeric( 1.8 ) );

    l.assign( 3, engine.newNumeric( 1./3 ) );

    l = (List)l.unique();

    System.out.println( l );



Executing this code produces the following output.

[1, 1.80000000000000004, .333333333333333315]

See Also

ExternalCalling/Java/MapleException. list, OpenMaple, OpenMaple/Java/API, OpenMaple/Java/Engine

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam