Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1.     @Override
  2.     public boolean contains(T item) {
  3.         // Assume it isn't
  4.         boolean returnValue = false;
  5.         // Loop through the list
  6.         Iterator<T> myIterator = this.iterator();
  7.         try {
  8.             while (myIterator.hasNext()) {
  9.                 // If the item is what we are looking for, we found it
  10.                 if (myIterator.next().equals(item)) {
  11.                     returnValue = true;
  12.                 }
  13.             }
  14.         } catch (NullPointerException e) {
  15.         }
  16.         return returnValue;
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement