I have a strong python background and a total newbie with Java, so I try to do things in Pythonic way in java and end up struggling. Currently I have a problem to figure out how to do store objects, indexed by coordinates, so that they are iterable. I could create an 2-dimensional array of the objects, but I'm afraid that would take a lot of memory AND I would have to iterate over all the indexes every time (when I only want to do it occasionally) to get all the objects.
In python, I would use a dictionary with tuples as keys, but looks like such thing is not possible in Java.
E.g.
class bar()
pass
bar1 = bar()
bar2 = bar()
# etc
foo = { (0,1): bar1, (100,30): bar2 }
for x in foo.values():
do_something()