Source of 2.21.java


  1: @author Frank M. Carrano, Timothy M. Henry
  2: @version 5.0
  3:         public boolean contains(T anEntry)
  4:         {
  5:       checkIntegrity();
  6:       boolean found = false;
  7:       int index = 0;
  8:       while (!found && (index < numberOfEntries))
  9:       {
 10:          if (anEntry.equals(bag[index]))
 11:          {
 12:             found = true;
 13:          } // end if
 14:          index++;
 15:       } // end while
 16:       
 17:       return found;
 18:         } // end contains