Skip to content

Instantly share code, notes, and snippets.

@HelloThisIsFlo
Created January 26, 2017 08:47
Show Gist options
  • Save HelloThisIsFlo/7d123be3c4d4f176a28875bc228c5a5c to your computer and use it in GitHub Desktop.
Save HelloThisIsFlo/7d123be3c4d4f176a28875bc228c5a5c to your computer and use it in GitHub Desktop.
public class SomeClass {
XmlParser xmlParser;
public SomeClass(XmlParser xmlParser) {
this.xmlParser = xmlParser;
}
public List<Book> findSpecificBookInFile(String bookName, String filePath) {
List<Book> fromFile = xmlParser.parseBooks(fileName);
return fromFile.stream()
.filter(book -> bookName.equals(book.title()))
.findFirst()
.orElse(Book.NULL);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment