Table.get
access the element associated with a key
Calling Sequence
Parameters
Description
Examples
Algebraic get( Algebraic key )
key
-
index of the element to access
The get function returns the Algebraic object associated with key in the Table. If no element is associated with key, the value null is returned.
The get function is identical to select except that the latter 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 );
Table t = (Table)engine.evaluate( "table([(1)=100,(2)=200,(3)=300,(4)=400]):" );
System.out.println( t.get( engine.newNumeric( 1 ) ) );
System.out.println( t.get( engine.newNumeric( 2 ) ) );
System.out.println( t.get( engine.newNumeric( 3 ) ) );
System.out.println( t.get( engine.newNumeric( 5 ) ) );
}
Executing this code produces the following output.
100
200
300
null
See Also
ExternalCalling/Java/MapleException
OpenMaple
OpenMaple/Java/Algebraic
OpenMaple/Java/API
OpenMaple/Java/Table
OpenMaple/Java/Table/assign
OpenMaple/Java/Table/clear
OpenMaple/Java/Table/has
OpenMaple/Java/Table/keySet
OpenMaple/Java/Table/remove
OpenMaple/Java/Table/unassign
OpenMaple/Java/Table/values
Download Help Document