public Book borrowBook(String title) {

            // initialize title
            _title = title;
            
            // get number of titles in queue
            getCopiesInQueue(title); 

            try {
                lock.lock();

                System.out.println("copies of " + _title + " in queue: " +  _availableToBorrow);
                
                if (_availableToBorrow == 0 || bookQueue.isEmpty()) {
                    System.out.println("not available");
                    JOptionPane.showMessageDialog(null, _title  + 
                                " is not avaiable to borrow", "Not Available", 
                                JOptionPane.INFORMATION_MESSAGE);
                    notEmpty.await();
                }
                
                for (int i = 0; i < bookQueue.size(); i++) {
                    if (_title.equalsIgnoreCase(bookQueue.get(i).getbookTitle()) && 
                            _availableToBorrow >= bookQueue.get(i).getCopiesAvailable()) {
 
                        _borrowBook = bookQueue.remove(i); // remove book from queue
                        _availableToBorrow--;
                        
                        System.out.println("book object removed: " + _borrowBook);
                        System.out.println("AV TO BOR: " + _availableToBorrow);
                        
                        notFull.signal(); // signal not full condition
                        break;
                    }
                   
                }
                if (lock.hasWaiters(notEmpty)) {
                    notEmpty.signal();
                }
            } catch (InterruptedException ex) {
                    ex.printStackTrace();
            } finally {
                lock.unlock();
                return _borrowBook;
            }
        }