Skip to content

Latest commit

 

History

History
19 lines (16 loc) · 445 Bytes

File metadata and controls

19 lines (16 loc) · 445 Bytes

Set Operations

1. Intersection

    set1.retainAll(set2);

Method retainAll modifies the set directly, keeps the values that are both in set1 & set2.

2. Union

    set1.addAll(set22);

Method addAll adds all the members of set2 to the set1 (modifying set1).

3. Relative Complement( Difference)

    set1.removeAll(set2);

Method removeAll keeps values that are in setA that don't exist in setB.