private void fillMapWithTemplateData(String textForTemplateExtraction,TemplateFilter filterToApply,int id,Map<String,Set<Integer>> mapToFill){
  Set<String> names=getTemplateNames(textForTemplateExtraction);
  for (  String name : names) {
    if (filterToApply.acceptTemplate(name)) {
      if (mapToFill.containsKey(name)) {
        Set<Integer> pIdList=mapToFill.remove(name);
        pIdList.add(id);
        mapToFill.put(name,pIdList);
      }
 else {
        Set<Integer> newIdList=new HashSet<Integer>();
        newIdList.add(id);
        mapToFill.put(name,newIdList);
      }
    }
  }
}

private void fillMapWithTemplateData ( String textForTemplateExtraction , TemplateFilter filterToApply , int id , Map < String , Set < Integer > > mapToFill ) { Set < String > names = getTemplateNames ( textForTemplateExtraction ) ; for ( String name : names ) { if ( filterToApply . acceptTemplate ( name ) ) { if ( mapToFill . containsKey ( name ) ) { Set < Integer > pIdList = mapToFill . remove ( name ) ; pIdList . add ( id ) ; mapToFill . put ( name , pIdList ) ; } else { Set < Integer > newIdList = new HashSet < Integer > ( ) ; newIdList . add ( id ) ; mapToFill . put ( name , newIdList ) ; } } } }
fill map ( maptofill ) with template data
