Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<Book> filterBooks(List<Book> readingList, String author)
- {
- // Remove all Books from the readingList that are not
- // written by the given author. Return the resulting List
- List<Book> newList = new ArrayList<Book>();
- for(int i = 0; i < readingList.size(); i++)
- {
- if(author.equals(readingList.get(i).getAuthor()))
- {
- newList.add(readingList.get(i));
- }
- }
- return newList;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement