Code example for Collator

Methods: setStrength

0
 
    /** 
     * Creates a new instance of NameOrder. 
     */ 
    public NameOrder() { 
        collator.setStrength(Collator.PRIMARY);
    } 
 
    /* 
     * Do string compare of names of UML objects.  Comparison is 
     * case insensitive using a primary strength collator in the user's 
     * locale. 
     *  
     * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) 
     */ 
    public int compare(Object obj1, Object obj2) {
         
	if (obj1 instanceof DefaultMutableTreeNode) {
	    DefaultMutableTreeNode node = (DefaultMutableTreeNode) obj1;
	    obj1 = node.getUserObject();
	}