Advertisement
Kimes

Untitled

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