title: Check if two collections are the same (ignoring order) using a custom equality function
body: <p>I'm having two collections of Foo. I can not change the implementation of Foo and Foo's equals function is implemented incorrectly. I can also not inherit from Foo. I do custom equality function: I've implemented using guava's Predicate function. To give you an idea, the implementation looks a bit like this.</p>
  
  <pre class="lang-java prettyprint-override"><code>new Predicate&lt;Pair&lt;Foo, Foo&gt;&gt;() {
          @Override
          public boolean apply(@Nullable Pair&lt;Foo, Foo&gt; input) {
            Foo one = input.getFirst();
            Foo two = input.getSecond();
            return Objects.equals(one.getId(), two.getId());
          }
        };
  </code></pre>
  
  
  
  <p>Now I need to check if my two collections of Foo contain the same items <strong>ignoring the order</strong> </p>
  
  <p>I'm looking for the best way to do this using this custom equality function.</p>