Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. public void insert_to_bookList(Book _input){
  2. int ListSize = BookList.size();
  3. boolean found=false;
  4. if (ListSize == 0) {
  5. BookList.add(_input);
  6. System.out.println("Book Added!");
  7. }else{
  8. for (Book entry : BookList) {
  9. if (_input.CallNumber.equals(entry.CallNumber) && _input.bookYear.equals(entry.bookYear)) {
  10. System.out.println("\nSorry that book already exists");
  11. found = true;
  12. }
  13. }
  14. if (found != true){
  15. BookList.add(_input);
  16. System.out.println("Book Added!!!");
  17. }
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement