code: public static Collection<TemplateEntry> findTemplatesForApplication( String appName, Collection<TemplateEntry> templates ) {
  
  		final Collection<TemplateEntry> result = new ArrayList<> ();
  		for( TemplateEntry te : templates ) {
  			// TE.appName == null => OK. It applies to this application.
  			// TE.appName == appName => OK. It also applies.
  			if( te.getAppName() == null || te.getAppName().equals( appName ))
  				result.add( te );
  		}
  
  		return result;
  	}
docs: Finds the templates that can apply to a given application.
  @param appName an application name (can be null to match all)
  @param templates a non-null collection of templates
  @return a non-null collection of templates