Created
August 20, 2019 14:53
-
-
Save amitkma/0a98f804c04bb9bdb144f65db7cb3dc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Library… | |
public Book[] booksAuthoredBy(String arg) { | |
List allBooks = finder.findAll(); | |
for (Iterator it = allBooks.iterator(); it.hasNext();) { | |
Book book = (Book) it.next(); | |
if (!book.getAuthor().equals(arg)) it.remove(); | |
} | |
return (Book[]) allBooks.toArray(new Book[allBooks.size()]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment