subList - 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


List.subList

return a sublist of the list

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

void subList( int a, int b ) throws MapleException

Parameters

a

-

index of the beginning of the range

b

-

index of the end of the range

Description

• 

The subList function returns a List object corresponding to the sublist from positions a (inclusive) to b (exclusive).

• 

Valid values of a and b are 0..n where n is the length of the list.  The length can be obtained by calling numElements.

• 

The input indices are zero-based; that is, the index of the first element is 0. See indexByRange for an equivalent which is zero-based.

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( "[2,4,6,8,10]:" );

        List l2 = l.subList( 2, 4 );

        System.out.prinln( "Sublist: " + l2 );

    }

}

Executing this code produces the following output.

[6, 8]

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/Algebraic

OpenMaple/Java/API

OpenMaple/Java/List

OpenMaple/Java/List/contains

OpenMaple/Java/List/containsAll

OpenMaple/Java/List/indexByRange

OpenMaple/Java/List/select

 


Download Help Document