private static Set < ORecord > mergeSet ( Set < ORecord > target , Set < ORecord > source ) { if ( source != null ) { if ( target == null ) { return source ; } else { if ( target . size ( ) > source . size ( ) ) { target . addAll ( source ) ; return target ; } else { source . addAll ( target ) ; return source ; } } } else { return target ; } }
Merge the two set try to use the optimum case