本文整理匯總了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");
}