Пример #1
0
  public static int compare(ExternalAccount first, ExternalAccount second) {
    if (first.getOnlineAccountType().equals(second.getAccountType()))
      if (first.isMugshotEnabledWithDefault()) return -1;
      else if (second.isMugshotEnabledWithDefault()) return 1;
      else return 0;

    // We want "my website" first, "blog" second, then everything alphabetized by the human-readable
    // name.

    if (first.getAccountType() == ExternalAccountType.WEBSITE) return -1;
    if (second.getAccountType() == ExternalAccountType.WEBSITE) return 1;
    if (first.getAccountType() == ExternalAccountType.BLOG) return -1;
    if (second.getAccountType() == ExternalAccountType.BLOG) return 1;

    return String.CASE_INSENSITIVE_ORDER.compare(
        first.getOnlineAccountType().getFullName(), second.getOnlineAccountType().getFullName());
  }