1 23 package com.sun.appserv.management.util.jmx; 24 25 import javax.management.Attribute ; 26 27 public final class AttributeComparator implements java.util.Comparator <Attribute > 28 { 29 public static final AttributeComparator INSTANCE = new AttributeComparator(); 30 31 private AttributeComparator() {} 32 33 public int 34 compare( Attribute attr1, Attribute attr2 ) 35 { 36 int result = attr1.getName().compareTo( attr2.getName() ); 37 if ( result == 0 ) 38 { 39 result = attr1.getValue().toString().compareTo( attr2.getValue().toString() ); 40 } 41 42 return( result ); 43 } 44 45 public boolean 46 equals( Object other ) 47 { 48 return( other instanceof AttributeComparator ); 49 } 50 } 51 52 53 | Popular Tags |