Recent Posts
None | 2 sec ago
None | 7 sec ago
Groovy | 13 sec ago
PHP | 15 sec ago
None | 28 sec ago
None | 1 min ago
None | 1 min ago
PHP | 1 min ago
XML | 2 min ago
None | 2 min ago
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By joey on the 9th of Feb 2010 11:30:29 PM Download | Raw | Embed | Report
  1.  public void remove(DataElement datum)
  2.     {
  3.         Iterator i = this.iterator();
  4.         boolean found = false;
  5.         Node tempElement = null;
  6.         Node prevElement = null;
  7.        
  8.         while (i.hasNext() ||  !found)
  9.         {
  10.             tempElement.data = i.getNext();
  11.             if (tempElement.data.equals(datum))
  12.             {   // found it, remove
  13.                 if (prevElement != null)
  14.                 {
  15.                     prevElement.link = tempElement.link;
  16.                 }
  17.                 else
  18.                 {   // this was first element
  19.                     first = null;
  20.                 }
  21.                 if (tempElement == last)
  22.                 {
  23.                     last = null;
  24.                 }      
  25.                 found = true;
  26.             }
  27.             else
  28.             {
  29.                 prevElement = tempElement;
  30.             }
  31.         }
  32.     }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: