testCoordinates.retainAll(coin.getCoordinates()); //I remove all elements from "testCoordinates" thatreturn true; return false;在我调用"retainAll"-method之后,"this.coordinates“中有0个元素,而之前有29个元素。我怀疑我可能误解了有关ArrayList声明或retainAll-方法的一些
如果我使用Mexico.retainAll(古巴);然后使用Mexico.retainAll(牙买加),它会给出所有访问过这三个国家的人的列表。分别是:奥利维亚,约翰,威廉 但是当我做Mexico.retainAll(古巴),然后Mexico.removeAll(牙买加)时,只吸引去过墨西哥和古巴的人,而不是牙买加。它给了我一套空的?visitorPatternNOOP.onlyMexicoCuba();
public void allThreeCountr
System.out.println("b is\t"+b); //System.out.println(intersection.retainAll(b)); System.out.println("intersection now is "+intersection);System.out.println("