Code examples
public class Polling <long> implements Iterator<long> { long[] sleepA = [1,10,33,77,200,3000] long sleepIdx = 0; public void setPolling(long[] pollTable){ sleepA = pollTable; } public boolean hasNext() { return true; } public long next() { if(success) sleepIdx=0 else if(sleepIdx<sleepA.length-1) sleepIdx++ } } do{ sleep(In.next()); }while(In.hasMore())Back to top