- Elements imageCell = document.select("table#AutoNumber2 tr:eq(1) img");
- return imageCell.hasAttr("src") ? FluentIterable.from(imageCell).transform(new Function<Element, Optional<String>>() {
-
- @Override
- public Optional<String> apply(Element elements) {
- return elements.hasAttr("src") ? Optional.of(elements.attr("src")) : Optional.<String>absent();
- }
- }).filter(new Predicate<Optional<String>>() {
-
- @Override
- public boolean apply(Optional<String> input) {
- return input.isPresent();
- }
- }).transform(new Function<Optional<String>, String>() {
+ Elements imageCells = selectImageAttributes(document);
+ return imageCells.stream().map(cell -> cell.attr("src")).collect(Collectors.toList());
+ }