Advertisement
techno-

TVRealityList

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