I have two objects: Books and BookLoans. All the books are stored on a ArrayList called books and Bookloans on loans.
A component of BookLoans is bookId. I want all books to be added to a combobox if the bookId doesn't already exist on the BookLoans List. Both the lists are different sizes.
I'm using MVC and the View side of the combobox is working.
I presume it will consists of two for-loops so this is my current attempt:
int length = books.size();
int loansLength = loans.size();
String[] listBooksCombo = new String[length];
for (int i = 0; i < loansLength; i++){
for(int j = 0; j < length; j++){
title = books.get(j).getTitle(); // Currently for testing purposes the getTitle and getBookId both are titles of a book
if(loans.get(i).getBookId() != title ){
listBooksCombo[j] = title;
}
currentView.comboBox(listBooksCombo); // sets the combo model
}
}
Currently the only result i've had is nothing appear in the combo box when there are objects in both array lists.