Bug 158020 Lazy initialize ViewerComparator.comparator
20060920 In the ViewerSorter I remember that a performance problem was that that the default constructor called Collator.getInstance() which can be expensive for the first caller. So in JDT we overrode getCollator() to do a lazy initialization. Couldn't this be added to the ViewerComparator by default? In ViewerSorter it wasn't possible as collator was protected. In ViewerComparator this isn't a problem. -> public ViewerComparator(){ this(null); } protected Comparator getComparator() { if (comparator == null) comparator= Policy.getComparator(); return comparator; }
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerComparator.java
* they may reimplement the <code>category</code> method to provide 
 * categorization; and they may override the <code>compare</code> methods
 * to provide a totally different way of sorting elements.
 * </p>
 * @see IStructuredContentProvider
 * @see StructuredViewer
 * 
 * @since 3.2
 */
public class ViewerComparator {
	/**
	 * The comparator to use to sort a viewer's contents.
	 */
	private Comparator comparator;
	/**
     * Creates a new {@link ViewerComparator}, which uses the default comparator
     * to sort strings.
	 *
	 */
	public ViewerComparator(){
		this(Policy.getComparator());
	}
	
	/**
     * Creates a new {@link ViewerComparator}, which uses the given comparator
     * to sort strings.
     * 
	 * @param comparator
	 */
	public ViewerComparator(Comparator comparator){