APL/DEV 3.4/TD4/DNAIterator.java

24 lines
434 B
Java
Raw Normal View History

2022-11-17 16:20:15 +01:00
import java.util.Iterator;
public class DNAIterator implements Iterator<DNALetter> {
private DNASequence first;
public DNAIterator(DNASequence first) {
this.first = first;
}
@Override
public boolean hasNext() {
return first != null;
}
@Override
public DNALetter next() {
DNALetter curr = first.getValue();
first = first.getNext();
return curr;
}
}