Q:

Reason behind Collections.sort(list) not working on (linked) hash sets?

Why doesn't the Collections.sort(list) method of Java Collections work on hash sets or linked hash sets? What is the reason behind that?

A:

This class implements the Set interface, backed by a hash table (actually a HashMap instance). It makes no guarantees as to the iteration order of the set; in particular, it does not guarantee that the order will remain constant over time. This class permits the null element.
From https://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html

