I am unable to change this foreach into a for loop. I can't use a foreach while using linked lists so i need to change this into a for loop instead
private boolean login(String username, String password) {
MyList<Admin> admins = null;
XStream xstream = new XStream(new DomDriver());
try {
ObjectInputStream is = xstream.createObjectInputStream(new FileReader("Admins.xml"));
admins = (MyList<Admin>) is.readObject();
is.close();
}
catch(FileNotFoundException e) {
admins = new MyList<Admin>();
txtFeedBackArea.setText("Password File not located");
return false;
}
catch (Exception e) {
txtFeedBackArea.setText("Error accessing Password File");
return false;
}
for (Admin admin: admins) {
if(admin.getUsername().equals(username) &&
admin.getPassword().equals(password))
return true;
}
return false;
}*/