Advertisement
techno-

TVRealityList

Nov 2nd, 2022
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 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.     List<String> lista = new ArrayList<String>();
  10.     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<String>(lista);
  21.         }else {
  22.             return new Rebote<String>(lista);
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement