On 24/06/2019 14:50, Alexey Ivanov wrote:
I guess that the change in doCompare() passed a review because it was assumed 
that the code inside will take care of unordered arrays. if we will drop the 
doCompare() then probably we need to sort the content of the arrays before 
Arrays.equals()?

I can't see where doCompare() handled unordered arrays; quite the opposite: doCompare(new String[]{"a", 
"b"}, new String[]{"a", "b"}) returns true (that is the arrays are *not equal*) whereas 
the arrays are *equal*.

That was an assumption on how it should work, but it was implemented 
differently.

While I run the test, the list of printers always has the same order. We do not 
sort the array returned by getAllPrinterNames() in 
PrintServiceLookupProvider.refreshServices(), so I assume Windows returns the 
installed printers in the same order. Therefore I think sorting the array is 
not necessary in this case.
I do not know, if it is always has the same order then the fix look fine, if we 
unsure then probably we can tweak it and sort.


--
Best regards, Sergey.

Reply via email to