Quaestion on the order of insertion on a Collection?
From:
Fabio Mascelloni
Subject:
Quaestion on the order of insertion on a Collection?
Date:
Fri, 05 Feb 1999 10:44:22 +0100
I need to insert members (chromosomes of a G.A.) in a collection in a descending
order estabilished by the fitness of the chromosome (a float value) .Since
It must be possible in my simulation to have objects with the same fitness
value (the same Key)
, a Map is not suitable.The other possibility is to use a Set
collection in which object with duplicate keys are accepted.What I've not
understood if
a) ordering of the members of collection is or is not automatic once
the compare function is provided .
b) how can be the kind of order (ascending or descending ) can be estabilished.
c) I'd like to be able to use - at: aKeySet method
to get all the members matching the same key.The fact is that I'd like
to use it also in an unordered list.Can I use Set without specifying
an ordering among members?
Hope I was clear, thanks in advance.
Fabio Mascelloni.