1 11 12 package org.eclipse.ui.internal.services; 13 14 import java.util.Comparator ; 15 16 import org.eclipse.ui.internal.util.Util; 17 18 32 public final class EvaluationResultCacheComparator implements Comparator { 33 34 public final int compare(final Object object1, final Object object2) { 35 if (Util.equals(object2, object1)) { 36 return 0; 37 } 38 39 final IEvaluationResultCache cache1 = (IEvaluationResultCache) object1; 40 final IEvaluationResultCache cache2 = (IEvaluationResultCache) object2; 41 int comparison; 42 43 48 if (object1 instanceof Comparable && object2 instanceof Comparable ) { 52 comparison = Util.compare((Comparable ) object2, 53 (Comparable ) object1); 54 if (comparison != 0) { 55 return comparison; 56 } 57 } 58 59 return Util.compareIdentity(cache2, cache1); 60 } 61 } 62 63 | Popular Tags |