public static < T > Set < T > minus ( Set < T > self , Object removeMe ) { Comparator comparator = ( self instanceof SortedSet ) ? ( ( SortedSet ) self ) . comparator ( ) : null ; final Set < T > ansSet = createSimilarSet ( self ) ; for ( T t : self ) { boolean areEqual = ( comparator != null ) ? ( comparator . compare ( t , removeMe ) == 0 ) : coercedEquals ( t , removeMe ) ; if ( ! areEqual ) ansSet . add ( t ) ; } return ansSet ; }
Create a Set composed of the elements of the first Set minus the given element .