问题是
Iterable#next()
(在JDK中)不允许抛出选中的异常(如
Profile.ConfigException
). 这就是为什么
org.cactoos.iterator.Mapped
抓住他们然后扔出去
UncheckedIOException
for
回路:
public Map<String, InputStream> assets() throws IOException {
final XML xml = this.read();
final List<XML> nodes = xml.nodes("/p/entry[@key='assets']/entry");
final List<MapEntry> entries = new LinkedList<>();
for (final XML node : nodes) {
entries.add(
new MapEntry<>(
input.xpath("@key").get(0),
this.asset(input.xpath("text()").get(0)) // checked exeption here
)
);
}
return new MapOf<>(entries);
}