Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. @Override
  2. public Iterator vytvorIterator(eTypProhl typ) {
  3. if (typ == eTypProhl.HLOUBKA) {
  4. return new Iterator() {
  5. Prvek index = koren;
  6. IAbstrLIFO<Prvek> zasobnik = new AbstrLIFO<>();
  7.  
  8. @Override
  9. public boolean hasNext() {
  10. return (!zasobnik.jePrazdny() || index != null);
  11. }
  12.  
  13. @Override
  14. public V next() {
  15. while (index != null) {
  16. zasobnik.vloz(index);
  17. index = index.levy;
  18. }
  19. index = zasobnik.odeber();
  20. V data = index.data;
  21. index = index.pravy;
  22. return data;
  23. }
  24. };
  25. } else {
  26. return new Iterator() {
  27. Prvek index = koren;
  28. IAbstrFIFO<Prvek> fronta = new AbstrFIFO<>();
  29.  
  30. @Override
  31. public boolean hasNext() {
  32. throw new UnsupportedOperationException("Not supported yet.");
  33. }
  34.  
  35. @Override
  36. public V next() {
  37. throw new UnsupportedOperationException("Not supported yet.");
  38. }
  39. };
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement