What will happen if I supply a non-transitive Comparator
to Collections.sort
? Can I run into infinite loop?
A small test I wrote produced an output, but I want to make sure this will always be the case.
The problem is that in some cases, my comparator can produce cycles, and in this case I just want to make sure it will not run into infinite loop. I don't care about the actual result.