當前位置: 首頁>>代碼示例>>Java>>正文


Java ImmutableList.sortedCopyOf方法代碼示例

本文整理匯總了Java中com.google.common.collect.ImmutableList.sortedCopyOf方法的典型用法代碼示例。如果您正苦於以下問題:Java ImmutableList.sortedCopyOf方法的具體用法?Java ImmutableList.sortedCopyOf怎麽用?Java ImmutableList.sortedCopyOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.ImmutableList的用法示例。


在下文中一共展示了ImmutableList.sortedCopyOf方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ProjectInfo

import com.google.common.collect.ImmutableList; //導入方法依賴的package包/類
@JsonCreator
public ProjectInfo(@JsonProperty("name") String name,
                   @JsonProperty("repos") List<RepoInfo> repos,
                   @JsonProperty("members") List<MemberInfo> members,
                   @JsonProperty("tokens") List<TokenInfo> tokens,
                   @JsonProperty("creation") UserAndTimestamp creation,
                   @JsonProperty("removal") @Nullable UserAndTimestamp removal) {
    this.name = requireNonNull(name, "name");
    this.repos = ImmutableList.sortedCopyOf(Comparator.comparing(RepoInfo::name),
                                            requireNonNull(repos, "repos"));
    this.members = ImmutableList.sortedCopyOf(Comparator.comparing(MemberInfo::login),
                                              requireNonNull(members, "members"));
    this.tokens = ImmutableList.sortedCopyOf(Comparator.comparing(TokenInfo::appId),
                                             requireNonNull(tokens, "tokens"));
    this.creation = requireNonNull(creation, "creation");
    this.removal = removal;
}
 
開發者ID:line,項目名稱:centraldogma,代碼行數:18,代碼來源:ProjectInfo.java

示例2: should_sort_health_responses

import com.google.common.collect.ImmutableList; //導入方法依賴的package包/類
@Test
public void should_sort_health_responses() {
    // GIVEN
    Sort sort = new Sort(
            new Order(ASC, "status"),
            new Order(DESC, "totalTimeMillis"),
            new Order(ASC, "service")
    );

    // WHEN
    Comparator<HealthResponse> comparator = sortCompare.getComparator(sort);
    List<HealthResponse> sorted = ImmutableList.sortedCopyOf(comparator, givenHealthResponses());

    // THEN
    then(sorted).extracting(HealthResponse::getService).containsExactly("E", "D", "C", "B", "A");
}
 
開發者ID:ePages-de,項目名稱:spring-boot-readiness,代碼行數:17,代碼來源:SortCompareTest.java

示例3: getAllCountries

import com.google.common.collect.ImmutableList; //導入方法依賴的package包/類
@GET
public Collection getAllCountries(@QueryParam("sort") String sort) {
    final ImmutableList<Country> sortedCountries;
    // Get query parameter
    if ("name,desc".equals(sort)) {
        sortedCountries = ImmutableList.sortedCopyOf(
                (a, b) -> b.getCode().compareTo(a.getCode()), this.countries);
    } else {
        // default sorting: name (ascending)
        sortedCountries = ImmutableList.sortedCopyOf(
                (a, b) -> a.getCode().compareTo(b.getCode()), this.countries);
    }
    return sortedCountries;
}
 
開發者ID:ceefour,項目名稱:java-web-services-training,代碼行數:15,代碼來源:CountriesController.java

示例4: AnnotatedDisease

import com.google.common.collect.ImmutableList; //導入方法依賴的package包/類
/**
 * Constructor.
 *
 * <p>
 * The alternative disease names will be sorted on construction.
 * </p>
 *
 * @param diseaseId The disease ID.
 * @param name The name of the disease.
 * @param alternativeNames Alternative disease names.
 * @param positiveAnnotations Positive disease annotations.
 * @param negativeAnnotations Negative disease annotations.
 */
public AnnotatedDisease(DiseaseId diseaseId, String name, Collection<String> alternativeNames,
    Collection<HpoDiseaseAnnotation> positiveAnnotations,
    Collection<HpoDiseaseAnnotation> negativeAnnotations) {
  this.diseaseId = diseaseId;
  this.name = name;
  this.alternativeNames = ImmutableList.sortedCopyOf(alternativeNames);
  this.positiveAnnotations = ImmutableList.copyOf(positiveAnnotations);
  this.negativeAnnotations = ImmutableList.copyOf(negativeAnnotations);
}
 
開發者ID:Phenomics,項目名稱:annotation-simulator,代碼行數:23,代碼來源:AnnotatedDisease.java


注:本文中的com.google.common.collect.ImmutableList.sortedCopyOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。