I want to go over the objects inside my TreeSet, I can do it by making an array using toArray but I don't need to go over all of the objects in the Set.
How can I go over the objects in the Set (starting with the first than the second etc') ?
And another small question about TreeSet : Can I keep the objects in the TreeSet sorted (so the first object will be with the smallest key etc') ?
edit: say I have a class myInt (with int myInteger) and I want to use it in TreeSet with a different oredering than the natural one, what do I need to define in my class (myInt) to do this ?