I can't find a tutorial of this, every tutorial seems to use an ArrayList of strings.
Suppose you have a class Person which has many attributes including name.
class person
{
public String name;
public int age;
public int weight;
public String hair_colour;
public String eye_colour;
};
You have a ArrayList of persons and you want to find one person in this ArrayList and you only have their name.
ArrayList<person> people = new ArrayList<person>();
How do I find "Fred"?
I know it's possible to loop though all the items in list but I want to do this properly with an Iterator.
Does anyone know of a tutorial to explain how to do a find on an ArrayList using an Iterator to find an item using just one attribute of that item?
Or is this just not possible? Have I misunderstood Iterator's?