Implementing the compareTo abstract method.
320396
public function compareTo($other)
    {
        if ($other === null) {
            return false;
        }
        if (!($other instanceof NumberNode)) {
            return false;
        }

        return $this->getValue() == $other->getValue();
    }
543591
@Override
    public int compareTo(Storage o) {
        return ComparisonChain.start()
                .compareTrueFirst(isConsistent(), o.isConsistent())  // Primaries *must* be consistent.
                .compareTrueFirst(_masterPrimary, o._masterPrimary)  // Master primary sorts first
                .compare(o.getPromotionId(), getPromotionId(), TimeUUIDs.ordering().nullsLast())  // Facade primary sorts first
                .compare(_uuid, o._uuid)  // Break ties in a way that's compatible with equals()
                .result();
    }
1326043
@Override
    public int compareTo(ADStarNodeImpl<A, S, C> o) {
        return this.key.compareTo(o.key);
    }
881245
@Override
	public int compareTo(LongValue o) {
		final long other = o.value;
		return this.value < other ? -1 : this.value > other ? 1 : 0;
	}
421746
@Override
  public int compareTo(Object other) {
    if (other == null) {
      return -1;
    }
    JobKey otherKey = (JobKey)other;
    return new CompareToBuilder().appendSuper(super.compareTo(otherKey))
        .append(this.jobId, otherKey.getJobId())
        .toComparison();
  }
446138
@Override
    public int compareTo(final AnnotationParameterValue other) {
        if (other == this) {
            return 0;
        }
        final int diff = name.compareTo(other.getName());
        if (diff != 0) {
            return diff;
        }
        if (value.equals(other.value)) {
            return 0;
        }
        // Use toString() order (which can be slow) as a last-ditch effort -- only happens
        // if the annotation has multiple parameters of the same name but different value. 
        final Object p0 = getValue();
        final Object p1 = other.getValue();
        return p0 == null || p1 == null ? (p0 == null ? 0 : 1) - (p1 == null ? 0 : 1)
                : toStringParamValueOnly().compareTo(other.toStringParamValueOnly());
    }
907178
protected int compare(MethodDesc o1, MethodDesc o2) {
		final Class<?>[] paramTypes1 = o1.getParameterTypes();
		final Class<?>[] paramTypes2 = o2.getParameterTypes();

		// sort by parameter types from left to right
		for (int i = 0; i < paramTypes1.length; i++) {
			final Class<?> class1 = paramTypes1[i];
			final Class<?> class2 = paramTypes2[i];

			if (class1.equals(class2))
				continue;
			if (class1.isAssignableFrom(class2) || Void.class.equals(class2))
				return -1;
			if (class2.isAssignableFrom(class1) || Void.class.equals(class1))
				return 1;
		}

		// sort by declaring class (more specific comes first).
		if (!o1.getDeclaringClass().equals(o2.getDeclaringClass())) {
			if (o1.getDeclaringClass().isAssignableFrom(o2.getDeclaringClass()))
				return 1;
			if (o2.getDeclaringClass().isAssignableFrom(o1.getDeclaringClass()))
				return -1;
		}

		// sort by target
		final int compareTo = ((Integer) targets.indexOf(o2.target)).compareTo(targets.indexOf(o1.target));
		return compareTo;
	}
648711
@Override
    public int compareTo(final MethodInfo other) {
        final int diff0 = declaringClassName.compareTo(other.declaringClassName);
        if (diff0 != 0) {
            return diff0;
        }
        final int diff1 = name.compareTo(other.name);
        if (diff1 != 0) {
            return diff1;
        }
        return typeDescriptorStr.compareTo(other.typeDescriptorStr);
    }
1314626
private static <T> ArrayList<T> sorted(Collection<T> cls, Comparator<? super T> c) {
    ArrayList<T> sorted = new ArrayList<>(cls);
    sorted.sort(c);
    return sorted;
  }
756532
@Override
  public int compareTo(TaskDetails otherTask) {
    if (otherTask == null) {
      return -1;
    }

    return new CompareToBuilder().append(this.taskKey, otherTask.getTaskKey())
        .toComparison();
  }
985903
@Override
    public int compareTo(ComparableMethod o) {
        if (o instanceof XMethod) {
            return XFactory.compare((XMethod) this, (XMethod) o);
        }
        throw new ClassCastException("Don't know how to compare " + this.getClass().getName() + " to " + o.getClass().getName());
    }
61946
@SuppressWarnings({ "rawtypes", "unchecked" })
    public static int compareTo(final Comparable thisValue, final Comparable otherValue, final OrderDirection orderDirection, final OrderDirection nullOrderDirection) {
        if (null == thisValue && null == otherValue) {
            return 0;
        }
        if (null == thisValue) {
            return orderDirection == nullOrderDirection ? -1 : 1;
        }
        if (null == otherValue) {
            return orderDirection == nullOrderDirection ? 1 : -1;
        }
        return OrderDirection.ASC == orderDirection ? thisValue.compareTo(otherValue) : -thisValue.compareTo(otherValue);
    }
1003014
@Override
    public int compareTo(Acronym o) {
        int compScore = _shortForm.compareTo(o._shortForm);
        if (compScore == 0) {
            compScore = _longForm.compareTo(o._longForm);
        }
        return compScore;
    }
296659
@Override
    public int compareTo(Object obj) throws ClassCastException {

        URI another = (URI) obj;
        if (!equals(_authority, another.getRawAuthority())) { 
            return -1;
        }
        return toString().compareTo(another.toString());
    }
421850
@Override
    public int compareTo(ObserverMethod o) {
        if (o == null) {
            return 1;
        }
        Integer a = getPresedence(getMethod());
        Integer b = getPresedence(o.getMethod());
        return b.compareTo(a);
    }
212762
@Override
	public int compareTo(CssLink o) {
		if (o == null) {
			return 1;
		}
		return Integer.valueOf(this.precedence).compareTo(o.precedence);
	}
165944
@Override
    public int compareTo(byte[] other, int off, int len) {
        ensureTextSet();
        return _comparatorInstance.compare(
                getBytes(), 0, getLength(),
                other, off, len);
    }