Note: Having done some quick benchmarks, Scanner turns out to be about four times slower than String.split. Hence, do not use Scanner.
(I'm leaving the post up to record the fact that Scanner is a bad idea in this case. (Read as: do not downvote me for suggesting Scanner, please...))
Assuming you are using Java 1.5 or higher, try Scanner, which implements Iterator<String>, as it happens:
Scanner sc = new Scanner("dog,,cat"); sc.useDelimiter(","); while (sc.hasNext()) { System.out.println(sc.next()); } gives:
dog cat