public final Token next() throws IOException { while (true) { if (!outQueue.isEmpty()) return outQueue.removeFirst(); Token t = read(); if (null == t) return null; Token out = process(t); if (null != out) return out; // loop back to top in case process() put something on the output queue } }