Advertisement
Kimes

Untitled

Mar 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 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.                 }
  9.             }
  10.         } else {
  11.             Book newBook = new Book(title, year, author, uniqueID, numberOfCopies);
  12.             bookMap.put(uniqueID, newBook);
  13.         }
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement