當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。