List.contains
test for membership in the List
Calling Sequence
Parameters
Description
Examples
boolean contains( Object value )
value
-
object to check
The contains function returns true if value is an element in the collection corresponding to the List and false otherwise.
This is similar to member except that it accepts an arbitrary Object and 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 );
List s = (List)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/List
OpenMaple/Java/List/assign
OpenMaple/Java/List/containsAll
OpenMaple/Java/List/select
Download Help Document