Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. public void removeCurrent() throws IllegalStateException
  2. {
  3. // check
  4. if (isCurrent() == false)
  5. {
  6. throw new IllegalStateException("No current");
  7. }
  8. else if (current == head)
  9. {
  10. previous = null;
  11. head.setLink(null);
  12. current = current.getLink();
  13. current = head;
  14. }
  15. else if (current != tail && current != head)
  16. {
  17. previous.setLink(current.getLink());
  18. current = previous.getLink();
  19. }
  20. else if (current == tail)
  21. {
  22. previous.setLink(current.getLink());
  23. current = null;
  24. }
  25. manyNodes--;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement