daily pastebin goal
76%
SHARE
TWEET

Untitled

a guest Apr 17th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public void removeGame(String name) throws IllegalArgumentException {
  2.        
  3.         if(name == null) {
  4.             throw new IllegalArgumentException();
  5.         }
  6.        
  7.         Game current = head;
  8.         Game previous = null;
  9.         Game next = current.getNext();
  10.        
  11.         while(current.getNext() != null) {
  12.             next = current.getNext();
  13.             if(current.getName() == name) {
  14.                 if (previous != null) {
  15.                   previous.setNext(next);              
  16.         } else {
  17.                   head = next;
  18.             }
  19.             previous = current;
  20.             current = next;
  21.  
  22.         }
  23.        
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top