get - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


List.get

return an element stored within a list

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Algebraic get( int i )

Parameters

i

-

index of the entry to return

Description

• 

The get function returns the Algebraic object stored in index i of the List.

• 

The index i is zero-based; valid values of i are 0..n1 where n is the length of the list.  The length can be obtained by calling numElements.

• 

This is identical to select except that its index is zero-based and does not throw a MapleException.

Examples

import com.maplesoft.openmaple.*;

import com.maplesoft.externalcall.MapleException;

class Example

{

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

    {

        String[] mapleArgs = { "java" };

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

        List l = (List)engine.evaluate( "[1, 4, 7]" );

        for (int i = 0; i < l.numelems(l); i++)

        {

            System.out.println( "Element: " + l.get(i) );

        }

}

Executing this code produces the following output.

Element: 1

Element: 4

Element: 7

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/Algebraic

OpenMaple/Java/API

OpenMaple/Java/Indexable

OpenMaple/Java/List

OpenMaple/Java/List/assign

OpenMaple/Java/List/contains

OpenMaple/Java/List/containsAll