Set.contains - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : OpenMaple : Java Application Programming Interface : Set Class : OpenMaple/Java/Set/contains

Set.contains

test for membership in the Set

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

boolean contains( Object value )

Parameters

value

-

object to check

Description

• 

The contains function returns true if value is an element in the collection corresponding to the Set and false otherwise.

• 

This is similar to member except that it accepts an arbitrary Object and does not throw a MapleException.

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

        Set s = (Set)engine.evaluate( "{2,5,sin(x),1+2*x+x^2,7.5};" );

        System.out.println( "Is 2 in the list: " + ind.contains( engine.newNumeric( 2 ) ) );

        System.out.println( "Is 7 in the list: " + ind.contains( engine.newNumeric( 7 ) ) );

    }

}

Executing this code produces the following output:

Is 2 in the list: true

Is 3 in the list: false

See Also

ExternalCalling/Java/MapleException

OpenMaple

OpenMaple/Java/Algebraic

OpenMaple/Java/API

OpenMaple/Java/Set

OpenMaple/Java/Set/containsAll

OpenMaple/Java/Set/iterator

OpenMaple/Java/Set/select

OpenMaple/Java/Set/toArray