Because sets have no ordering. Some implementations do (particularly those implementing the java.util.SortedSet
interface), but that is not a general property of sets.
If you’re trying to use sets this way, you should consider using a list instead.