The other answer would be: why do you want this? You can iterate over a Set with a foreach construct just fine.
If you're having problems with ConcurrentUpdateExceptions, you need to create a copy of the set anyway, using List won't reliably prevent the ConcurrentUpdateExceptions. (LinkedList should have a constructor that takes any Collection, creating such a copy. Any other Collection descendant should have the same. Or you could use Set#toArray().)
If you wish to have the related entities in a given repeatable order, using a List would establish that, but you'll usually get some random order. You'd either use a Criteria query with an ordering options, which will return a List just fine, or you'd place the Set elements in an array and sort that using a Comparator object. (There is no "natural" order on related entities. The system doesn't know which of the many possible ways to define an ordering is the one that you want. That's why you usually need Order By, or Comparator, or some other way to establish an ordering; it's rare that the implicit ordering is indeed enough.)
|