This line regularly fails for me on OpenJDK.

Is there a smoother way to test for equivalence than relying on this method?

I changed it to use LinkedHashSet but it still fails regularly (although not all the time).