本文整理汇总了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;
}
示例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;
}
示例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");
}