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


Java TreeMultimap.get方法代码示例

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


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

示例1: forkByClassifier

import com.google.common.collect.TreeMultimap; //导入方法依赖的package包/类
private Map<String, TreeMultimap<Calendar, ItemInfo>> forkByClassifier(
        TreeMultimap<Calendar, ItemInfo> cleanupCandidates) {
    Map<String, TreeMultimap<Calendar, ItemInfo>> result= Maps.newHashMap();
    for (Calendar calendar : cleanupCandidates.keySet()) {
        NavigableSet<ItemInfo> itemInfos = cleanupCandidates.get(calendar);
        for (ItemInfo itemInfo : itemInfos) {
            String classifier=resolveClassifier(itemInfo);
            TreeMultimap<Calendar, ItemInfo> classifierMap = result.get(classifier);
            if(classifierMap==null){
                //classifierMap= TreeMultimap.create(Ordering.natural().reverse(), Ordering.natural().reverse());
                classifierMap= TreeMultimap.create(Ordering.natural(), Ordering.natural());;
                result.put(classifier,classifierMap);
            }
            classifierMap.put(calendar,itemInfo);
        }
    }
    return result;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:19,代码来源:IntegrationCleanupServiceImpl.java

示例2: writeIFile

import com.google.common.collect.TreeMultimap; //导入方法依赖的package包/类
static Path writeIFile(int keysPerFile, int repeatCount) throws
    IOException {
  TreeMultimap<Integer, Long> dataSet = createDataForIFile(keysPerFile, repeatCount);
  LOG.info("DataSet size : " + dataSet.size());
  Path path = new Path(workDir + "/src", "data_" + System.nanoTime() + ".out");
  FSDataOutputStream out = localFs.create(path);
  //create IFile with RLE
  IFile.Writer writer = new IFile.Writer(defaultConf, out, IntWritable.class
      , LongWritable.class, null, null, null, true);

  for (Integer key : dataSet.keySet()) {
    for (Long value : dataSet.get(key)) {
      writer.append(new IntWritable(key), new LongWritable(value));
      verificationDataSet.put(key, value);
    }
  }
  writer.close();
  out.close();
  return path;
}
 
开发者ID:apache,项目名称:tez,代码行数:21,代码来源:TestTezMerger.java

示例3: getRecommendation

import com.google.common.collect.TreeMultimap; //导入方法依赖的package包/类
/**
 * Methods to retrieve Document that is similar to a given document
 *
 * @param _documentNumber
 * @param _resultsType
 * @return
 * @throws com.google.api.services.datastore.client.DatastoreException
 */
@Override
public RecResponseBean getRecommendation(
        final long _documentNumber,
        ResultsType _resultsType) throws DatastoreException, DocumentNotFoundException {

    DocumentBean baseDocument = dao.getDocument(_documentNumber);
    TreeMultimap<BaseContent.ContentType, BaseContent> relevantBeans = baseDocument.getRelevantBeans();
    SortedSet<BaseContent> topicRelatedBeans = relevantBeans.removeAll(BaseContent.ContentType.TOPICS);
    //TODO: Filter Topics that are the same as that of the base document

    Collection<String> entityIds = new ArrayList<String>();
    for (BaseContent contentBean : relevantBeans.values()) {
        entityIds.add(ContentDictionary.makeKeyFromBean(contentBean));
    }

    TreeMultimap<BaseContent.ContentType, DocumentMeta> entityResult = dao.getEntityMeta(entityIds, _resultsType);
    Collection<DocumentMeta> result = new ArrayList<DocumentMeta>();
    for (BaseContent.ContentType contentType : entityResult.keySet()) {
        Collection<DocumentMeta> docMetas = new ArrayList<DocumentMeta>(entityResult.get(contentType));
        CollectionUtils.filterInverse(docMetas, new Predicate<DocumentMeta>() {
            @Override
            public boolean evaluate(DocumentMeta documentMeta) {
                return (documentMeta.getDocumentNumber() == _documentNumber);
            }
        });
        result.addAll(ResultsType.getResultsForCR(docMetas, _resultsType));
    }

    // Filter down the result (select randomly from the top results)
    result = ResultsType.getResultsForCR(result, ResultsType.RANDOM_10);
    result = ResultsType.getResultsForCR(result, _resultsType);

    Collection<DocumentBean> recommendedResults = new ArrayList<DocumentBean>();
    for (DocumentMeta docMeta : result) {
        recommendedResults.add(dao.getDocument(docMeta.getDocumentNumber()));
    }

    return new RecResponseBean(recommendedResults, "ContentBased");
}
 
开发者ID:balarj,项目名称:rmend-be,代码行数:48,代码来源:ContentRecommender.java


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