Advertisement
techno-

TVRealityList

Nov 4th, 2022
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. package e2;
  2.  
  3. import java.util.Iterator;
  4. import java.util.List;
  5.  
  6. public class TVRealityList implements Iterable<String> {
  7.     public List<String> getLista() {
  8.         return lista;
  9.     }
  10.  
  11.     private List<String> lista;
  12.     private boolean circular;
  13.     private int k;
  14.  
  15.     public TVRealityList(List<String> lista, boolean circular, int k) {
  16.         this.lista=lista;
  17.         this.circular=circular;
  18.         this.k=k;
  19.     }
  20.  
  21.     @Override
  22.     public Iterator<String> iterator(){
  23.         if(circular){
  24.             return new Circular(lista,k);
  25.         }else {
  26.             return new Rebote(lista,k);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement