001package com.fs.starfarer.api.util;
002
003import java.util.ArrayList;
004import java.util.Iterator;
005import java.util.List;
006
007public class SaveableIterator<T> implements Iterator<T>{
008
009        private List<T> list;
010        private int index;
011        public SaveableIterator(List<T> list) {
012                this.list = new ArrayList<T>(list);
013                index = -1;
014        }
015
016        public boolean hasNext() {
017                return index + 1 < list.size();
018        }
019
020        public T next() {
021                index++;
022                return list.get(index);
023        }
024
025        public void remove() {
026                throw new UnsupportedOperationException();
027        }
028}