Advertisement
techno-

TVRealityList

Nov 4th, 2022
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 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.  
  14.     public void setK(int k) {
  15.         this.k = k;
  16.     }
  17.  
  18.     private int k;
  19.  
  20.     public TVRealityList(List<String> lista, boolean circular) {
  21.         this.lista=lista;
  22.         this.circular=circular;
  23.  
  24.     }
  25.  
  26.     @Override
  27.     public Iterator<String> iterator(){
  28.         if(circular){
  29.             return new Circular(lista,k);
  30.         }else {
  31.             return new Rebote(lista,k);
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement