Print out names from Mapped information
<p>I've created a Map with ten people's details, I want to then print out the names. 
At the moment I have to print out each one individually, I want to have about 200 people so I wanted to know if it would be possible to print the names out in a loop. </p>

<p>(simplified code)</p>

<pre><code>public class PersonDetails implements Serializable {

    private String name;
    private int age;
    ...

    public PersonDetails(int Age, String Name) {

        name = Name;
        age = Age;
        ...
    }
}




public class Test implements Serializable {

   Map&lt;String, PersonDetails&gt; people = new TreeMap&lt;String, PersonDetails&gt;();

public Test() {

        //10 people added
        for(int x = 0; x&lt;10; x++){
            addPerson();
        }

        PersonDetails p0 = people.get("0");
        String p0name = p0.getName();
        System.out.println(p0name);

        PersonDetails p1 = people.get("1");
        String p1name = p1.getName();
        System.out.println(p1name);

        PersonDetails p2 = people.get("2");
        String p2name = p2.getName();
        System.out.println(p2name);

        PersonDetails p3 = people.get("3");
        String p3name = p3.getName();
        System.out.println(p3name);
        ...
        (I would like to loop this)
}
</code></pre>

<p>OUTPUT: 
Connor
Phil
Nick
Mike
Sarah
Tom
Jenny
Eric
Jerry
Dave</p>

<p>Is it possible to have the same output and loop these outputs? I have tried an ArrayLists but I can't get it to work with this problem, and I am not sure if it is possible.
Thanks</p>
