@@ -22,8 +22,8 @@ All the examples in this section require the biojava-dna module.
2222` List ` <Symbol >` mySeq = SymbolListFormatter.parseSymbolList(mySeqString); `
2323` `
2424` // Is it a big list? Don't want to hold it all in memory? Use an iterator instead. `
25- ` Iterator ` <Symbol >` myIterator = SymbolListFormater.parseSymbols(mySeqString); `
26- ` while ( myIterator.hasNext()) { `
25+ ` for ( Iterator ` <Symbol >` myIterator = SymbolListFormater.parseSymbols(mySeqString); `
26+ ` myIterator.hasNext(); ) { `
2727` Symbol sym = myIterator.next(); `
2828` } `
2929` `
@@ -106,8 +106,8 @@ A quality-scored DNA sequence
106106### Iterating over the base/score pairs
107107
108108` // A 1-indexed iterator and ListIterators are also available. `
109- ` Iterator ` <TaggedSymbol<Integer >` > iter = scoredSeq.taggedSymbolIterator(); `
110- ` while ( iter.hasNext()) { `
109+ ` for ( Iterator ` <TaggedSymbol<Integer >` > iter = scoredSeq.taggedSymbolIterator(); `
110+ ` iter.hasNext(); ) { `
111111` TaggedSymbol ` <Integer >` taggedSym = iter.next(); `
112112` Symbol sym = taggedSym.getSymbol(); `
113113` Integer score = taggedSym.getTag(); `
@@ -124,8 +124,7 @@ A quality-scored DNA sequence
124124### Iterating over the scores only
125125
126126` // A ListIterator is also available, as are 1-indexed iterators. `
127- ` Iterator ` <Integer >` iter = scoredSeq.tagIterator(); `
128- ` while (iter.hasNext()) { `
127+ ` for (Iterator ` <Integer >` iter = scoredSeq.tagIterator(); iter.hasNext(); ) { `
129128` Integer score = iter.next(); `
130129` } `
131130
@@ -144,9 +143,9 @@ simpler for the most common use-cases.
144143
145144### Parsing a FASTA file (the easy way)
146145
147- ` ThingParser ` <FASTA >` parser = ThingParserFactory. `
148- ` getReadParser(FASTA.format, new File("/path/to/my/fasta.fa")); `
149- ` while ( parser.hasNext()) { `
146+ ` for ( ThingParser ` <FASTA >` parser = ThingParserFactory. `
147+ ` getReadParser(FASTA.format, new File("/path/to/my/fasta.fa")); `
148+ ` parser.hasNext(); ) { `
150149` FASTA fasta = parser.next(); `
151150` // fasta contains a complete FASTA record. `
152151` } `
@@ -156,8 +155,8 @@ simpler for the most common use-cases.
156155
157156` FASTAReader reader = new FASTAFileReader(new File("/path/to/my/fasta.fa")); `
158157` FASTABuilder builder = new FASTABuilder(); `
159- ` ThingParser ` <FASTA >` parser = new ThingParser ` <FASTA >` (reader, builder); `
160- ` while ( parser.hasNext()) { `
158+ ` for ( ThingParser ` <FASTA >` parser = new ThingParser ` <FASTA >` (reader, builder); `
159+ ` parser.hasNext(); ) { `
161160` FASTA fasta = parser.next(); `
162161` // fasta contains a complete FASTA record. `
163162` } `
0 commit comments