[Java] Move predicate into filtering iterator.