1 <p> This call to a generic collection method contains an argument
2 with an incompatible class from that of the collection's parameter
3 (i.e., the type of the argument is neither a supertype nor a subtype
4 of the corresponding generic type argument).
5 Therefore, it is unlikely that the collection contains any objects
6 that are equal to the method argument used here.
7 Most likely, the wrong value is being passed to the method.</p>
8 <p>In general, instances of two unrelated classes are not equal.
9 For example, if the <code>Foo</code> and <code>Bar</code> classes
10 are not related by subtyping, then an instance of <code>Foo</code>
11 should not be equal to an instance of <code>Bar</code>.
12 Among other issues, doing so will likely result in an equals method
13 that is not symmetrical. For example, if you define the <code>Foo</code> class
14 so that a <code>Foo</code> can be equal to a <code>String</code>,
15 your equals method isn't symmetrical since a <code>String</code> can only be equal
16 to a <code>String</code>.
18 <p>In rare cases, people do define nonsymmetrical equals methods and still manage to make
19 their code work. Although none of the APIs document or guarantee it, it is typically
20 the case that if you check if a <code>Collection<String></code> contains
21 a <code>Foo</code>, the equals method of argument (e.g., the equals method of the
22 <code>Foo</code> class) used to perform the equality checks.