I have a list of objects. I would like to create individual objects from this list with a method and not calling always: personList.get(0), personList.get(1), etc. The object name should be the Person name from the list element.
List<Person> personList = ...;
I'd like to iterate over the personList and create new objects by name for each object from the list.
Person class contains name attribute with a getter.
How can I do that?