Skip to content

Commit 0afbaf4

Browse files
Newacctandreasprlic
authored andcommitted
Change to wiki page
1 parent 2bf3bed commit 0afbaf4

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

_wikis/BioJava3:HowTo.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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
` }`

_wikis/BioJava3:HowTo.mediawiki

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ All the examples in this section require the biojava-dna module.
1212
List<Symbol> mySeq = SymbolListFormatter.parseSymbolList(mySeqString);
1313
1414
// Is it a big list? Don't want to hold it all in memory? Use an iterator instead.
15-
Iterator<Symbol> myIterator = SymbolListFormater.parseSymbols(mySeqString);
16-
while (myIterator.hasNext()) {
15+
for (Iterator<Symbol> myIterator = SymbolListFormater.parseSymbols(mySeqString);
16+
myIterator.hasNext(); ) {
1717
Symbol sym = myIterator.next();
1818
}
1919
@@ -95,8 +95,8 @@ All the examples in this section require the biojava-dna module.
9595
=== Iterating over the base/score pairs ===
9696

9797
// A 1-indexed iterator and ListIterators are also available.
98-
Iterator<TaggedSymbol<Integer>> iter = scoredSeq.taggedSymbolIterator();
99-
while (iter.hasNext()) {
98+
for (Iterator<TaggedSymbol<Integer>> iter = scoredSeq.taggedSymbolIterator();
99+
iter.hasNext(); ) {
100100
TaggedSymbol<Integer> taggedSym = iter.next();
101101
Symbol sym = taggedSym.getSymbol();
102102
Integer score = taggedSym.getTag();
@@ -113,8 +113,7 @@ All the examples in this section require the biojava-dna module.
113113
=== Iterating over the scores only ===
114114

115115
// A ListIterator is also available, as are 1-indexed iterators.
116-
Iterator<Integer> iter = scoredSeq.tagIterator();
117-
while (iter.hasNext()) {
116+
for (Iterator<Integer> iter = scoredSeq.tagIterator(); iter.hasNext(); ) {
118117
Integer score = iter.next();
119118
}
120119
@@ -128,9 +127,9 @@ Convenience wrapper classes are provided to make the parsing process simpler for
128127

129128
=== Parsing a FASTA file (the easy way) ===
130129

131-
ThingParser<FASTA> parser = ThingParserFactory.
132-
getReadParser(FASTA.format, new File("/path/to/my/fasta.fa"));
133-
while (parser.hasNext()) {
130+
for (ThingParser<FASTA> parser = ThingParserFactory.
131+
getReadParser(FASTA.format, new File("/path/to/my/fasta.fa"));
132+
parser.hasNext(); ) {
134133
FASTA fasta = parser.next();
135134
// fasta contains a complete FASTA record.
136135
}
@@ -140,8 +139,8 @@ Convenience wrapper classes are provided to make the parsing process simpler for
140139

141140
FASTAReader reader = new FASTAFileReader(new File("/path/to/my/fasta.fa"));
142141
FASTABuilder builder = new FASTABuilder();
143-
ThingParser<FASTA> parser = new ThingParser<FASTA>(reader, builder);
144-
while (parser.hasNext()) {
142+
for (ThingParser<FASTA> parser = new ThingParser<FASTA>(reader, builder);
143+
parser.hasNext(); ) {
145144
FASTA fasta = parser.next();
146145
// fasta contains a complete FASTA record.
147146
}

0 commit comments

Comments
 (0)