Code example for Queue

Methods: isEmpty, remove

0
        this.matched = matched;
        this.unmatched = unmatched;
    } 
 
    protected T getNext() throws Exception { 
        if (!matched.isEmpty()) {
            return matched.remove();
        } 
        if (!underlyingIterator.hasNext()) {
            return finished(); 
        } 
        T t = underlyingIterator.next();
        if (predicate.matches(t)) {
            return t;
        } 
        unmatched.add(t);
        return getNext(); 
    } 
}