public static TemplateHashModelEx combineMaps(TemplateHashModelEx first,TemplateHashModelEx second,SetOperations ops,ObjectWrapper objectWrapper) throws TemplateModelException {
  SimpleHash res=new SimpleHash(objectWrapper);
  if (ops == null || ops == SetOperations.UNION) {
    addToSimpleMap(res,first);
    addToSimpleMap(res,second);
  }
 else   if (ops == SetOperations.INTERSECT) {
    Set<String> intersectKeys=toStringSet(second.keys());
    intersectKeys.retainAll(toStringSet(first.keys()));
    addToSimpleMap(res,second,intersectKeys);
  }
 else   if (ops == SetOperations.DIFFERENCE) {
    Set<String> diffKeys=toStringSet(first.keys());
    diffKeys.removeAll(toStringSet(second.keys()));
    addToSimpleMap(res,first,diffKeys);
  }
 else {
    throw new TemplateModelException("Unsupported combineMaps operation");
  }
  return res;
}

public static TemplateHashModelEx combineMaps ( TemplateHashModelEx first , TemplateHashModelEx second , SetOperations ops , ObjectWrapper objectWrapper ) throws TemplateModelException { SimpleHash res = new SimpleHash ( objectWrapper ) ; if ( ops == null || ops == SetOperations . UNION ) { addToSimpleMap ( res , first ) ; addToSimpleMap ( res , second ) ; } else if ( ops == SetOperations . INTERSECT ) { Set < String > intersectKeys = toStringSet ( second . keys ( ) ) ; intersectKeys . retainAll ( toStringSet ( first . keys ( ) ) ) ; addToSimpleMap ( res , second , intersectKeys ) ; } else if ( ops == SetOperations . DIFFERENCE ) { Set < String > diffKeys = toStringSet ( first . keys ( ) ) ; diffKeys . removeAll ( toStringSet ( second . keys ( ) ) ) ; addToSimpleMap ( res , first , diffKeys ) ; } else { throw new TemplateModelException ( "Unsupported combineMaps operation" ) ; } return res ; }
combines two maps with the given operator into a new hash .
