I am using springs AutoPopulateList using the following METHOD 1
passports = new AutoPopulatingList<Passport>(Passport.class);
method2 as well as first creating a Passportfactory
public class PassportFactory implements AutoPopulatingList.ElementFactory {
private Person person;
public PassportFactory(Person person) {
this.person = person;
}
public Object createElement(int index) {
Passport passport = new Passport();
passport.setPerson(person);
return passport;
}
}
and then using this
List<Passport> passports = new AutoPopulatingList(new PassportFactory(this));
Now both codes work, but I donβt know what the difference is between the two and how the second code will be useful because it is copied from the Internet. Can someone explain the difference to me
John
source
share