Generics and wildcards with collections in Java
问题 In a test class using AssertJ, I have code similar to the following: public void someTest() { assertThat(getNames()).has(sameNamesAs(getExpectedNames())); assertThat(getNames()).doesNotHave(sameNamesAs(getOtherNames())); } private List<String> getNames() { return null; } private List<String> getExpectedNames() { return null; } private List<String> getOtherNames() { return null; } private Condition<List<String>> sameNamesAs(List<String> rhs) { return new Condition<List<String>>("same names as