1: /** Tests whether this bag contains a given entry. 2: @param anEntry The entry to locate. 3: @return True if the bag contains anEntry, or false otherwise. */ 4: public boolean contains(T anEntry) 5: { 6: boolean found = false; 7: Node currentNode = firstNode; 8: 9: while (!found && (currentNode != null)) 10: { 11: if (anEntry.equals(currentNode.data)) 12: found = true; 13: else 14: currentNode = currentNode.next; 15: } // end while 16: return found; 17: } // end contains