Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package e2;
- import java.util.ArrayList;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Spliterator;
- import java.util.function.Consumer;
- public class Circular<String> extends TVRealityList<String> implements Iterator<String>{
- int pos= 0;
- public Circular(List<String> lista, boolean circular){
- super(lista,circular);
- }
- @Override
- public boolean hasNext() {
- if (lista.size()>1){
- return true;
- } else return false;
- }
- @Override
- public String next() {
- pos++;
- int poscorrecta = pos % lista.size();
- String resultado = lista.get(poscorrecta);
- return resultado;
- }
- @Override
- public void remove() {
- Iterator.super.remove();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement