-1

What is wrong with the following code? How can you fix it?

I want to remove the book that is sent to the function removeAllBooks

// Remove all the books which contain the given keyword in book title
    public void removeAllBooks(String keyword) {

        for(Book b: booksList) {
            if (b.getTitle().indexOf(keyword)>=0) {
                booksList.remove(b);
            }
        }
    }

Omar
  • 1
  • 1

0 Answers0