1:
2: /** Tests whether this bag contains a given entry.
3: @param anEntry the entry to locate
4: @return true if this bag contains anEntry, or false otherwise */
5: public boolean contains(T anEntry)
6: {
7: checkInitialization();
8: boolean found = false;
9: int index = 0;
10: while (!found && (index < numberOfEntries))
11: {
12: if (anEntry.equals(bag[index]))
13: {
14: found = true;
15: } // end if
16: index++;
17: } // end while
18:
19: return found;
20: } // end contains