public void intersectWith ( Intersection < T > arg ) { // if the argument is top then leave all as is if ( arg . elements != null ) { // if arg is empty, the result is empty if ( arg . elements . isEmpty ( ) ) elements = Collections . emptySet ( ) ; else { if ( elements == null ) // we have top, the intersection is sub elements = new HashSet <> ( arg . elements ) ; // copy the set else elements . retainAll ( arg . elements ) ; } } }
modifies by intersecting with another intersection