Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void addBook(Book newAddbook) {
- if (bookMap.values().isEmpty()) {
- Integer id = uniqueID++;
- newAddbook.setId(id);
- bookMap.put(id, newAddbook);
- return;
- }
- for (Book book : bookMap.values()){
- if (book.equals(newAddbook)) {
- book.addCopy();
- return;
- } else {
- Integer id = uniqueID++;
- newAddbook.setId(id);;
- bookMap.put(id, newAddbook);
- return;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment