daily pastebin goal
29%
SHARE
TWEET

anan

a guest Dec 17th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  public boolean remove(int number) {
  2.         ListCell prev = null;
  3.         ListCell cell = this.head;
  4.  
  5.         while (cell != null) {
  6.             if (cell.number == number) {
  7.                 if (prev != null) {
  8.                     prev.next = cell.next;
  9.                 } else {
  10.                     // If no prev, already, it is first.
  11.                     this.head = this.head.next;
  12.                 }
  13.                 return true;
  14.             }
  15.             prev = cell;
  16.             cell = cell.next;
  17.         }
  18.         return false;
  19.     }
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