public void addBook(Book book, ReplySystem replySystem) { if (!replySystem.equals(null)) { if (book.isInStore() == false) { if (books.contains(book) == false) { books.add(book); } } else { books.add(book); } for (Reply reply : replySystem.getReplies()) { boolean condition = (reply.getBook().getAuthor().equals(book.getAuthor())) && ((reply.getBook().getName().equals(book.getName()))) && ((reply.getBook().getPrice() == book.getPrice())) && ((reply.getBook().getDateOfPublication().get(Calendar.YEAR)) == (book.getDateOfPublication().get(Calendar.YEAR))) && ((reply.getBook().getDateOfPublication().get(Calendar.MONTH)) == (book.getDateOfPublication().get(Calendar.MONTH))) && ((reply.getBook().getDateOfPublication().get(Calendar.DATE)) == (book.getDateOfPublication().get(Calendar.DATE))) && (book.isInStore()); if (condition) { reply.setExecuted(true); ; } } } }