Advertisement
Guest User

Untitled

a guest
May 28th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. private class AVLIterator<E> implements Iterator<E>{
  2.  
  3. private String[] stack;
  4. public Node curr;
  5. private int index = 0;
  6.  
  7. private AVLIterator(StackBlock s){
  8. stack = s;
  9. curr = stack[index];
  10. }
  11.  
  12. public boolean hasNext(){
  13.  
  14. if(curr.next !=null){
  15. return true;
  16. }
  17.  
  18. else{
  19. return false;
  20. }
  21. }
  22.  
  23. public Object next(){
  24. if(hasNext() = false){
  25. throw new NoSuchElementException();
  26. }
  27. else{
  28. return stack[index++];
  29. }
  30.  
  31. }
  32.  
  33. public void remove(){
  34. throw new NoSuchElementException();
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement