protected void mergeAdvices(Entitlement e1,Entitlement e2){
  Map<String,Set<String>> result=new HashMap<String,Set<String>>();
  Map<String,Set<String>> a1=e1.getAdvices();
  if (a1 == null) {
    a1=Collections.EMPTY_MAP;
  }
  Map<String,Set<String>> a2=e2.getAdvices();
  if (a2 == null) {
    a2=Collections.EMPTY_MAP;
  }
  Set<String> names=new HashSet<String>();
  names.addAll(a1.keySet());
  names.addAll(a2.keySet());
  for (  String n : names) {
    Set<String> advice1=a1.get(n);
    Set<String> advice2=a2.get(n);
    Set<String> r=result.get(n);
    if (r == null) {
      r=new HashSet<String>();
      result.put(n,r);
    }
    if ((advice1 != null) && !advice1.isEmpty()) {
      r.addAll(advice1);
    }
    if ((advice2 != null) && !advice2.isEmpty()) {
      r.addAll(advice2);
    }
  }
  e1.setAdvices(result);
}

protected void mergeAdvices ( Entitlement e1 , Entitlement e2 ) { Map < String , Set < String > > result = new HashMap < String , Set < String > > ( ) ; Map < String , Set < String > > a1 = e1 . getAdvices ( ) ; if ( a1 == null ) { a1 = Collections . EMPTY_MAP ; } Map < String , Set < String > > a2 = e2 . getAdvices ( ) ; if ( a2 == null ) { a2 = Collections . EMPTY_MAP ; } Set < String > names = new HashSet < String > ( ) ; names . addAll ( a1 . keySet ( ) ) ; names . addAll ( a2 . keySet ( ) ) ; for ( String n : names ) { Set < String > advice1 = a1 . get ( n ) ; Set < String > advice2 = a2 . get ( n ) ; Set < String > r = result . get ( n ) ; if ( r == null ) { r = new HashSet < String > ( ) ; result . put ( n , r ) ; } if ( ( advice1 != null ) && ! advice1 . isEmpty ( ) ) { r . addAll ( advice1 ) ; } if ( ( advice2 != null ) && ! advice2 . isEmpty ( ) ) { r . addAll ( advice2 ) ; } } e1 . setAdvices ( result ) ; }
sets the advices of the first entitlement to be the union of all advices from the first and second entitlements .
