MySQL results to ArrayLisy
I'm writing a reasonabily basic program which uses a basic MVC pattern.
In my model I'm retreiving information (email and password) from a MySQL database which I'd like to store in an ArrayList (I'm under the impression that it's better to store the data in an ArrayList rather than anything else), this array list is then going to be accessed from the Controller which will update a JTable within the View.
I'm unsure as to how to add the data to the ArrayList as I'm looping through the data and wondered whether anyone here could help me?
My code looks like this:
Thank you in advance!
ArrayList resList = new ArrayList();
String email = rs.getString(2);
String password = rs.getString(3);
/*Unsure as to how to add the above email and password to an ArrayList*/