Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //If not, go through a for loop (count) amount of times or until found==true
- else
- {
- current = contents.getNext();
- //Looks like it just goes through the linkedset while saving the previous element so it can do previous.setNext at the end
- for (int look=0; look < count && !found; look++)
- if (current.getElement().equals(target))
- found = true;
- else
- {
- current = current.getNext();
- }
- if (!found)
- throw new NoSuchElementException();
- //So to get here, current equals the element, and you need to setnext the previous to current.getNext
- result = current.getElement();
- current.getPrevious().setNext(current.getNext());
- }
Add Comment
Please, Sign In to add comment