Advertisement
Kimes

Untitled

Mar 23rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. public void addBook(String title, String year, String author) {
  2.         uniqueID++;
  3.         if (bookMap.isEmpty() == false) {
  4.             for (Book book : bookMap.values()) {
  5.                 if (book.getTitle().equals(title) && (book.getYear().equals(year))
  6.                         && (book.getAuthor().equals(author))) {
  7.                     book.addCopy();
  8.                 } else {
  9.                     Book newBook = new Book(title, year, author, uniqueID, numberOfCopies);
  10.                     bookMap.put(uniqueID, newBook);
  11.                 }
  12.             }
  13.         } else {
  14.             Book newBook = new Book(title, year, author, uniqueID, numberOfCopies);
  15.             bookMap.put(uniqueID, newBook);
  16.         }
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement