Le’t have 2 arrays (of String, but it doesn’t really matter). I need to compare them, but the order is irrelevant, just that they contain the same Strings/items (and are of the same length, obviously).
i.e. comparison of
x1 = [“a”, “b”, “c”]
x2 = [“c”, “b”, “a”]
should return true (equality).
What would be the fastest, most efficient way to do that?
Thank you, everyone.
I actually don’t envision in my code any possibility of a duplicate in either array.
Here are interesting efficiency test results of suggested solutions: