diff --git a/src/main/java/org/ntlab/citrusserver/repositories/PublicBookManager.java b/src/main/java/org/ntlab/citrusserver/repositories/PublicBookManager.java index b6452cb..3969edb 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/PublicBookManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/PublicBookManager.java @@ -13,13 +13,10 @@ @Repository public class PublicBookManager implements IBookListener{ - private final BookManager bookManager; - private final HashMap> publicBooks = new HashMap<>(); public PublicBookManager(BookManager bookManager) { - this.bookManager = bookManager; - this.bookManager.addListener(this); + bookManager.addListener(this); } public ArrayList getAllPublicBooks(){ @@ -43,7 +40,10 @@ return books; } + public ArrayList searchBooksByTitle(String title, int sortBy){ + ArrayList result = searchBooksByTitle(title); +// result.sort(Comparator.comparing(Book::)) return null; } @@ -65,12 +65,13 @@ public ArrayList searchBooksByTitleAndAccount(String title, String accountId){ ArrayList books = searchBooksByTitle(title); + ArrayList result = new ArrayList<>(); for(Book book : books){ if(book.getAccountId().equals(accountId)){ - books.add(book); + result.add(book); } } - return books; + return result; } @Override