Skip to content

Commit

Permalink
Use BufferedReader.lines() to process all lines
Browse files Browse the repository at this point in the history
This method was added in Java 8.

Signed-off-by: BJ Hargrave <bj@hargrave.dev>
  • Loading branch information
bjhargrave committed Jun 27, 2022
1 parent d6a319d commit 278a431
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 4 additions & 3 deletions biz.aQute.bnd/src/aQute/bnd/main/MbrCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import aQute.bnd.repository.maven.provider.MavenBndRepository;
import aQute.bnd.version.MavenVersion;
import aQute.bnd.version.Version;
import aQute.lib.collections.LineCollection;
import aQute.lib.collections.MultiMap;
import aQute.lib.getopt.Arguments;
import aQute.lib.getopt.Description;
Expand Down Expand Up @@ -191,10 +190,12 @@ private boolean update(MavenBndRepository repo, Map<Archive, MavenVersion> trans
Iterator<String> lc;
if (repo.getIndexFile()
.isFile()) {
lc = new LineCollection(repo.getIndexFile());
lc = IO.reader(repo.getIndexFile())
.lines()
.iterator();
bnd.trace("reading %s", repo.getIndexFile());
} else {
lc = new ArrayList<String>().iterator();
lc = Collections.emptyIterator();
}

for (Iterator<String> i = lc; i.hasNext();) {
Expand Down
9 changes: 3 additions & 6 deletions biz.aQute.bndlib/src/aQute/bnd/maven/MavenCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import aQute.bnd.osgi.Processor;
import aQute.bnd.osgi.Resource;
import aQute.bnd.util.home.Home;
import aQute.lib.collections.LineCollection;
import aQute.lib.io.IO;
import aQute.lib.settings.Settings;
import aQute.lib.utf8properties.UTF8Properties;
Expand Down Expand Up @@ -145,11 +144,9 @@ private void settings() throws FileNotFoundException, Exception {
error("There is no settings file at '%s'", settings.getAbsolutePath());
return;
}
try (LineCollection lc = new LineCollection(IO.reader(settings))) {
while (lc.hasNext()) {
System.err.println(lc.next());
}
}
IO.reader(settings)
.lines()
.forEachOrdered(System.err::println);
}

/**
Expand Down

0 comments on commit 278a431

Please sign in to comment.