Details
Description
The org.opengis.metadata API uses Collection, in order to let the choice for implementors between List and Set. The Geotoolkit implementation uses Set by default. However this choice is unsafe because the elements added in those Set may be modified by the user after the insertion, thus breaking the HashSet contract.
The safest fix is to relies on List instead than Set. This change doesn't have any impact on the public API. However if a user cast the return value of a metadata method, the result of the cast may change.

Collections of immutable elements like CodeList, Enum and String can continue to be of kind Set. This is usually the intended behavior at least for enumerations and code lists. The strings are usually unique identifiers (otherwise they would be InternationalString). By keeping using Set instead than List for those types, we keep the comparaisons of collections insensitive to element order (as they were before).
Comparaison of collection of metadata are now sensitive to elements order, since they are now backed by List instead than Set.