List.length - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : Java Application Programming Interface : List Class : OpenMaple/Java/List/length

List.length

return the length of the List

 

Calling Sequence

Description

Examples

Calling Sequence

int length( ) throws MapleException

Description

• 

The length function returns the number of elements that the List can store.

Examples

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.evaluate( "[1,2,3,4]:" );

    System.out.println( l.length() );

    l = engine.newList( 3 );

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

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

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

    l = (List)l.unique();

    System.out.println( l.length() );

    l = (List)engine.evaluate( "[seq( i, i=1..100 )]:" );

    System.out.println( l.length() );

    }

}

Executing this code produces the following output.

4

3

100

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/Algebraic

OpenMaple/Java/API

OpenMaple/Java/List

OpenMaple/Java/List/assign

OpenMaple/Java/List/select

 


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