Table.indexEntryPairs - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : Java Application Programming Interface : Table Class : OpenMaple/Java/Table/indexEntryPairs

Table.indexEntryPairs

get list of index/entry pairs

 

Calling Sequence

Description

Examples

Calling Sequence

List indexEntryPairs() throws MapleException

Description

• 

The indexEntryPairs function returns a List whose elements are Relation objects, each of which corresponds with a single index/entry pair from the Table.

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 );

        Table tab = (Table)engine.evaluate( "table([a=1,b=2,c=3,d=2]):" );

        System.out.println( "Size of table: " + tab.numElements() );

        List pairlist = tab.indexEntryPairs();

        for (Algebraic elem : pairlist) {

              Relation pair = (Relation)elem;

            System.out.println( "Key: " + pair.lhs() + ", Value: " + pair.rhs() );

        }

}

Executing this code produces the following output.

Size of table: 4

Key: a, Value: 1

Key: b, Value: 2

Key: c, Value: 3

Key: d, Value: 2

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/Algebraic

OpenMaple/Java/API

OpenMaple/Java/Table

OpenMaple/Java/Table/assign

OpenMaple/Java/Table/has

OpenMaple/Java/Table/select