Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1.  
  2. public class IteradorListaDoblementeLigada<T> implements Iterator<T>{
  3.  
  4. private NodoLista<T> nodo;
  5.  
  6. public IteradorListaDoblementeLigada(NodoLista<T> inicio){
  7. nodo = inicio;
  8. }
  9.  
  10.  
  11. @Override
  12. public boolean hasNext() {
  13. // TODO Auto-generated method stub
  14.  
  15. return nodo!= null && nodo.getSiguiente()!= null;
  16. }
  17.  
  18. @Override
  19. public T next() {
  20. // TODO Auto-generated method stub
  21. if(!hasNext())throw new NoSuchElementException (
  22. "end of the iteration");
  23. T dato = nodo.getDato();
  24. nodo = nodo.getSiguiente();
  25. return dato;
  26. }
  27.  
  28. @Override
  29. public void remove() {
  30. // TODO Auto-generated method stub
  31.  
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement