title: Check if a Particular Object is in a List Using a Given Implementation of equals()
body: <p>I need to check if an equivalent instance of a particular Object is in a List. </p>
  
  <p>The Objects are instances of a Final Class that has an equals method that is too strict. I want to be able to provide a different implementation of <code>equals</code> to a "contains" method to check if the object is contained in the List. </p>
  
  <p>The equals method in the class below will return false if the elements of <code>partsInBox</code> are in a different order; I need to change this behavior to be order indiscriminate. </p>
  
  <pre><code>public final class Box {
      String category;
      List&lt;Integer&gt; partsInBox;
  
      @Override
      public boolean equals(Object o) {
          if (this == o) { return true; }
          if (o == null || getClass() != o.getClass()) { return false; }
  
          Box box = (Box) o;
  
          return category.equals(box.category) 
                  &amp;&amp; partsInBox.equals(box.partsInBox);
      }
  }
  </code></pre>
  
  <p>I would like to be able to do something like this:</p>
  
  <pre><code>List&lt;Box&gt; boxes; // list that I am checking
  Box myBox; // what I am checking for
  
  boolean contained = contatins(boxes, box, new EqualsMethod() {
      @Override
      public boolean areEqual(Box b1, Box b2) {
          if (b1 == b2) { return true; }
  
          return b1.category.equals(b2.category)
                  &amp;&amp; b1.partsInBox.containsAll(b2.partsInBox);
      }
  });
  </code></pre>
  
  <p>What are my options for achieving this type of functionality? </p>