toList - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


Indexable.toList

convert collection to a list

Indexable.toSet

convert collection to a set

 

Calling Sequence

Description

Examples

Calling Sequence

List toList() throws MapleException

Set toSet() throws MapleException

Description

• 

The toList function returns a List with the contents from the Indexable expression.

• 

The toSet function returns a Set with the contents from the Indexable expression.

• 

If toList is invoked when the current Indexable is already a list or toSet is invoked when the current Indexable is already a set, then a reference to the current object is returned.

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

        Indexable ind = (Indexable)engine.evaluate( "{3,5,7,9,10}:" );

        List l = ind.toList();

        System.out.println( "Size of list result: " + l.numElements() );

        ind = (Indexable)engine.evaluate( "table([a=3,b=7,c=9,d=3,e=13]):" );

        Set s = ind.toSet();

        System.out.println( "Size of set result: " + s.numElements() );

}

Executing this code produces the following output.

Size of list result: 5

Size of set result: 4

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/Algebraic

OpenMaple/Java/API

OpenMaple/Java/Indexable

OpenMaple/Java/Indexable/max

OpenMaple/Java/Indexable/member

OpenMaple/Java/Indexable/min

OpenMaple/Java/Indexable/numElements

 


Download Help Document