当前位置: 首页>>代码示例>>Java>>正文


Java Ordering.from方法代码示例

本文整理汇总了Java中com.google.common.collect.Ordering.from方法的典型用法代码示例。如果您正苦于以下问题:Java Ordering.from方法的具体用法?Java Ordering.from怎么用?Java Ordering.from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.collect.Ordering的用法示例。


在下文中一共展示了Ordering.from方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeAnnotations

import com.google.common.collect.Ordering; //导入方法依赖的package包/类
public void writeAnnotations(Writer out) throws IOException {
    List<MapItem> mapItems = dexFile.getMapItems();
    // sort the map items based on the order defined by sectionAnnotationOrder
    Ordering<MapItem> ordering = Ordering.from(new Comparator<MapItem>() {
        @Override public int compare(MapItem o1, MapItem o2) {
            return Ints.compare(sectionAnnotationOrder.get(o1.getType()), sectionAnnotationOrder.get(o2.getType()));
        }
    });

    mapItems = ordering.immutableSortedCopy(mapItems);

    try {
        for (MapItem mapItem: mapItems) {
            SectionAnnotator annotator = annotators.get(mapItem.getType());
            annotator.annotateSection(this);
        }
    } finally {
        dexFile.writeAnnotations(out, this);
    }
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:21,代码来源:DexAnnotator.java

示例2: updateSavedBuildTypes

import com.google.common.collect.Ordering; //导入方法依赖的package包/类
private void updateSavedBuildTypes( ) {
    final List<BuildTypeData> monitoredBuildTypes = _buildManager.getMonitoredBuildTypes( );

    final Ordering<BuildTypeData> ordering = Ordering.from( Comparator.comparingInt( _buildManager::getPosition ) );

    final List<SavedBuildTypeData> buildToSaved = ordering.sortedCopy( monitoredBuildTypes ).stream( )
            .map( data -> new SavedBuildTypeData( data.getId( ), data.getName( ), data.getProjectId( ), data.getProjectName( ), data.getAliasName( ) ) )
            .collect( Collectors.toList( ) );

    _configuration.setSavedBuilds( buildToSaved );
}
 
开发者ID:u2032,项目名称:wall-t,代码行数:12,代码来源:ConfigurationController.java

示例3: updateSavedProjects

import com.google.common.collect.Ordering; //导入方法依赖的package包/类
private void updateSavedProjects( ) {
    final List<ProjectData> monitoredProjects = _projectManager.getMonitoredProjects( );

    final Ordering<ProjectData> ordering = Ordering.from( Comparator.comparingInt( _projectManager::getPosition ) );

    final List<SavedProjectData> projectToSaved = ordering.sortedCopy( monitoredProjects ).stream( )
            .map( data -> new SavedProjectData( data.getId( ), data.getName( ), data.getParentId( ).orElse( null ), data.getAliasName( ) ) )
            .collect( Collectors.toList( ) );

    _configuration.setSavedProjects( projectToSaved );
}
 
开发者ID:u2032,项目名称:wall-t,代码行数:12,代码来源:ConfigurationController.java

示例4: byPatternsCondition

import com.google.common.collect.Ordering; //导入方法依赖的package包/类
public static Ordering<RequestHandler> byPatternsCondition() {
    return Ordering.from(new Comparator<RequestHandler>() {
        @Override
        public int compare(RequestHandler first, RequestHandler second) {
            return first.getRequestMapping().getPatternsCondition().toString()
                    .compareTo(second.getRequestMapping().getPatternsCondition().toString());
        }
    });
}
 
开发者ID:apcc4m,项目名称:sdoc,代码行数:10,代码来源:DocumentScanner.java


注:本文中的com.google.common.collect.Ordering.from方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。