Implementation of comparableSwapped interface, sorting by second then
first.

@param other Object to compare to
@return comparison result
163472
public int compareSwappedTo(IntDoublePair other) {
    int fdiff = Double.compare(this.second, other.second);
    if(fdiff != 0) {
      return fdiff;
    }
    return this.first - other.first;
  }
299036
public OrderingList<S> mergeRemainderOrdering(OrderingScore<S> other) {
        OrderingList<S> thisRemainderOrdering = getRemainderOrdering();

        if (this == other) {
            return thisRemainderOrdering;
        }

        OrderingList<S> otherRemainderOrdering = other.getRemainderOrdering();

        // Choose the longer list.

        if (thisRemainderOrdering.size() == 0) {
            return otherRemainderOrdering;
        } else {
            if (otherRemainderOrdering.size() == 0) {
                return thisRemainderOrdering;
            } else if (thisRemainderOrdering.size() >= otherRemainderOrdering.size()) {
                return thisRemainderOrdering;
            } else {
                return otherRemainderOrdering;
            }
        }
    }
1203987
public int firstIndexOfDifference(Permutation other) {
        int r = 0;
        while ((r < values.length) && values[r] == other.get(r)) {
            r++;
        }
        return r;
    }
1146868
@Override
    public int compareTo(MimeType other) {
        int comp = getType().compareToIgnoreCase(other.getType());
        if (comp != 0) {
            return comp;
        }
        comp = getSubtype().compareToIgnoreCase(other.getSubtype());
        if (comp != 0) {
            return comp;
        }
        comp = getParameters().size() - other.getParameters().size();
        if (comp != 0) {
            return comp;
        }
        TreeSet<String> thisAttributes = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
        thisAttributes.addAll(getParameters().keySet());
        TreeSet<String> otherAttributes = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
        otherAttributes.addAll(other.getParameters().keySet());
        Iterator<String> thisAttributesIterator = thisAttributes.iterator();
        Iterator<String> otherAttributesIterator = otherAttributes.iterator();
        while (thisAttributesIterator.hasNext()) {
            String thisAttribute = thisAttributesIterator.next();
            String otherAttribute = otherAttributesIterator.next();
            comp = thisAttribute.compareToIgnoreCase(otherAttribute);
            if (comp != 0) {
                return comp;
            }
            String thisValue = getParameters().get(thisAttribute);
            String otherValue = other.getParameters().get(otherAttribute);
            if (otherValue == null) {
                otherValue = "";
            }
            comp = thisValue.compareTo(otherValue);
            if (comp != 0) {
                return comp;
            }
        }
        return 0;
    }
752042
@Override
    public int compareTo(Request<T> other) {
        Priority left = this.getPriority();
        Priority right = other.getPriority();

        // High-priority requests are "lesser" so they are sorted to the front.
        // Equal priorities are sorted by sequence number to provide FIFO ordering.
        return left == right ?
                this.sequence - other.sequence :
                right.ordinal() - left.ordinal();
    }
925401
@SuppressWarnings("ObjectEquality")
    public int compareTo(int offset, int length, Slice that, int otherOffset, int otherLength)
    {
        return compareTo(offset, length, that.base, otherOffset, otherLength);
    }
166993
public CompareResult compare(final Object pvObject1, final Object pvObject2) {
		CompareResult[] lvCompareResults = null;
		lvCompareResults = compareIntern(pvObject1, pvObject2, true);
		CompareResult lvResult = (lvCompareResults == null ? null : lvCompareResults[0]);
		return lvResult;
	}
787198
public int compare(final T first, final T second) {
    int cmpRs = 0;
    for (final Comparator<T> com : comparators) {
      cmpRs = com.compare(first, second);
      if (0 == cmpRs) {
        continue;
      } else {
        break;
      }
    }
    return cmpRs;
  }
318315
public int compareTo(Weighted<DirectedEdge> other) {
        return ComparisonChain.start()
                .compare(other.weight, weight)
                .compare(Objects.hashCode(other.val), Objects.hashCode(val))
                .result();
    }
854987
public static <E> int compare(final Comparable<E> obj1, final E obj2) {
        if (obj1 == obj2) {
            return 0;
        }
        if (obj1 == null) {
            return -1;
        }
        if (obj2 == null) {
            return 1;
        }

        return obj1.compareTo(obj2);
    }
31253
@Override
    public int compareTo(final Pair<L, R> other) {
      return new CompareToBuilder().append(getLeft(), other.getLeft())
              .append(getRight(), other.getRight()).toComparison();
    }
1344472
@Override
  public int compareTo(Trigger other) {

    if (other.getName() == null && getName() == null) {
      return 0;
    }
    if (other.getName() == null) {
      return -1;
    }
    if (getName() == null) {
      return 1;
    }

    return getName().compareTo(other.getName());
  }
593049
public static ListValue of(Timestamp first, Timestamp... other) {
    return newBuilder().addValue(first, other).build();
  }
1212606
@Override
    public int compareTo(Task<R> another) {
        int me = Constants.PRIORITY_MAP[priority&Constants.PRIORITY_MASK];
        int you = Constants.PRIORITY_MAP[another.priority&Constants.PRIORITY_MASK];
        return me == you ?
                seqNumber - another.seqNumber :
                you - me;
    }
369227
@Override
  public int compareTo(Comparable<?> other) {
    if (other instanceof Region) {
      Region r = (Region) other;
      if (this.start < r.start) {
        return -1;
      } else if (this.end > r.end) {
        return 1;
      } else {
        return 0;
      }
    } else if (other instanceof Long) {
      Long l = (Long) other;
      if (l > end) {
          return -1;
      } else if (l < start) {
          return 1;
      } else {
          return 0;
      }
    } else {
      throw new AssertionError();
    }
  }
922959
public static int compare(Term self, Term other) {

		// Sanity check.
		if (self == null || other == null) {
			throw new NullPointerException();
		}

		// Identical objects are always equal.
		if (self == other) {
			return 0;
		}

		// Easy case is when they are not the same type of term.
		if (self.isKey() != other.isKey()) {
			return (self.isKey()) ? 1 : -1;
		}

		// Compare the underlying values.
		try {
			if (self.isKey()) {
				return self.getKey().compareTo(other.getKey());
			} else {
				return self.getIndex().compareTo(other.getIndex());
			}
		} catch (InvalidTermException consumed) {
			// This statement can never be reached because both objects are
			// either keys or indexes. This try/catch block is only here to make
			// the compiler happy.
			assert (false);
			return 0;
		}
	}
1245890
public int compareTo (Name other)
    {
        Integer override = overrideCompareTo(other);
        if (override != null) {
            return override;
        } else if ((override = other.overrideCompareTo(this)) != null) {
            return -override;
        }
        Class<?> c = getClass();
        Class<?> oc = other.getClass();
        if (c == oc || c.getName().equals(oc.getName())) {
            return getNormal().compareTo(other.getNormal());
        } else {
            return c.getName().compareTo(oc.getName());
        }
    }