arraylist query

From: JoshB (metrix007_at_yahoo.com)
Date: 03/30/04


Date: 30 Mar 2004 10:51:51 -0800

Hi folks,

Just learning arraylists at the moment, and ran into a problem with
the trying to return the result of the contains method.

I have an arraylist called the set, and the following code:

    public boolean hasElement(int element) {

        // ***** SD2 Gap Assignment 2 Question 3 *****

        if ((element < smallest) || (element > largest)) {
            return false;
        } // if.
       
        
       return theSet.contains(element);
        
    }

however it gives the error "cannot resolve symbol"
symbol : method contains (int)
location: interface java.util.List
        theSet.contains(element);

any suggestions as to why this is happening?

Many thanks.