You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
343 B
Java
16 lines
343 B
Java
package _4._2;
|
|
|
|
public class Primes extends Filter {
|
|
public Primes() {
|
|
super(new Naturals());
|
|
this.sequence.getNext(); // remove 1 form the sequence
|
|
}
|
|
|
|
@Override
|
|
public int getNext() {
|
|
int ret = this.sequence.getNext(); // also removes ret form the sequence
|
|
this.sequence = new ZapMultiples(ret, this.sequence);
|
|
return ret;
|
|
}
|
|
}
|