Im trying to iterate through a Treemap of the class Tile() using:
Map map = new TreeMap();
Iterator itr = world.map.values().iterator();
while(itr.hasNext()){
Tile t = ???;
System.out.print(t.xCord+","+t.yCord+","+t.zCord);
}
How do I get the instance of the object Tile within the iterator? Or if theres some better way of doing this, plz let me know.
I’ve tried googling this, but I always end up looking at ways to iterate through pure data, like strings etc, and not Instanciations of class’…
Strings aren’t pure data in Java, they are objects, so is the same:
Or better:
or even better:
p.s
Keyis the class of the key objects you’re using