List.get
return an element stored within a list
Calling Sequence
Parameters
Description
Examples
Algebraic get( int i )
i
-
index of the entry to return
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..n−1 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.
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
Download Help Document