두 세트의 교집합을 계산하는 방법은 무엇입니까? [복제] 가능한 중복 : 가변 개수의 스트링 세트의 교차점을 효율적으로 찾는 해시 셋이 두 개 있다고 가정 해보자. Set s1 = new HashSet(); Set s2 = new HashSet(); S1 INT S2 ? 다음 retainAll()방법을 사용하십시오 Set. Set s1; Set s2; s1.retainAll(s2); // s1 now contains only elements in both sets 세트를 유지하려면 교차점을 보유 할 새 세트를 작성하십시오 . Set intersection = new HashSet(s1); // use the copy constructor intersection.retainAll(s2); 의 javadoc..