当前位置: 首页>>代码示例>>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;未经允许,请勿转载。