private static Collection difference ( Collection first , Collection second ) { if ( first == null ) { return EMPTY_LIST ; } if ( second == null ) { return first ; } Collection difference = new ArrayList <> ( first ) ; for ( Object current : second ) { difference . remove ( current ) ; } return difference ; }
Difference that handle properly collections with duplicates .