title: How do I check in Swift if two arrays contain the same elements regardless of the order in which those elements appear in?
body: <p>Let's say there are two arrays...</p>
  
  <pre><code>var array1 = ["a", "b", "c"]
  var array2 = ["b", "c", "a"]
  </code></pre>
  
  <p>I'd like the result of the comparison of these two arrays to be true, and the following...</p>
  
  <pre><code>var array1 = ["a", "b", "c"]
  var array2 = ["b", "c", "a", "d"]
  </code></pre>
  
  <p>...to be false. How can I achieve that in Swift? I tried to convert both arrays to sets but for some reason Set() keeps removing some (usually duplicated) objects that the array contains.</p>
  
  <p>Any help would be appreciated.</p>