Categories : Java
List<Book> bookList     =   new ArrayList<Book>();
List<Book> removeList   =   new ArrayList<Book>();

for(Book book:bookList){
    // add if statement to decide to remove from list
    removeList.add(book);
}

bookList.removeAll(removeList);

You need to add if statment before removeList.add(book) line to delete element from list.

Leave a Reply

Your email address will not be published.