Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void addBook(String title, String year, String author) {
- uniqueID++;
- if (bookMap.isEmpty() == false) {
- for (Book book : bookMap.values()) {
- if (book.getTitle().equals(title) && (book.getYear().equals(year))
- && (book.getAuthor().equals(author))) {
- numberOfCopies++;
- } else {
- break;
- }
- }
- } else {
- Book newBook = new Book(title, year, author, uniqueID, numberOfCopies);
- bookMap.put(uniqueID, newBook);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement