Bug 5095 template: toarray incorrect
its defintion should be: (${type}[]) ${collection}.toArray(new ${type}[${collection}.size()]); rather than (${type}[]) ${collection}.toArray(new ${type}[${collection}]);
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/template/TemplateSet.java
}
	
	/**
	 * Returns all templates.
	 */
	public Template[] getTemplates() {
		return (Template[]) fTemplates.toArray(new Template[fTemplates.size()]);
	}
	
	/**
	 * Returns templates matching a prefix.
	 */
	public Template[] getMatchingTemplates(String prefix, String partitionType) {
		Assert.isNotNull(prefix);
		Assert.isNotNull(partitionType);
		List results= new ArrayList(fSortedTemplates.length);
		for (int i= 0; i != fSortedTemplates.length; i++) {
			Template template= fSortedTemplates[i];
			if (template.matches(prefix, partitionType))
				results.add(template);							
		}
		return (Template[]) results.toArray(new Template[results.size()]);
	}
	private void sort() {
		fSortedTemplates= (Template[]) fTemplates.toArray(new Template[fTemplates.size()]);
		Arrays.sort(fSortedTemplates, fTemplateComparator);
	}
	
}