示例#1
0
 @Override
 public List<BookEntity> findBooksByAuthor(String author) {
   List<BookEntity> matchingList = new ArrayList<BookEntity>();
   for (BookEntity bookEntity : ALL_BOOKS) {
     if (bookEntity.matchingAuthors(author)) {
       matchingList.add(bookEntity);
     }
   }
   return matchingList;
 }
示例#2
0
 @Override
 public List<BookEntity> findBookByTitle(String title) {
   List<BookEntity> matchingList = new ArrayList<BookEntity>();
   for (BookEntity bookEntity : ALL_BOOKS) {
     if (bookEntity.getTitle().toLowerCase().startsWith(title.toLowerCase())) {
       matchingList.add(bookEntity);
     }
   }
   return matchingList;
 }