本文整理匯總了Java中com.google.common.collect.TreeMultimap.entries方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeMultimap.entries方法的具體用法?Java TreeMultimap.entries怎麽用?Java TreeMultimap.entries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.TreeMultimap
的用法示例。
在下文中一共展示了TreeMultimap.entries方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visitObjectLiteral
import com.google.common.collect.TreeMultimap; //導入方法依賴的package包/類
@Override
public String visitObjectLiteral(ObjectLiteral node, Void context) {
StringBuilder builder = new StringBuilder("{");
boolean first = true;
TreeMultimap<String, Expression> sorted = TreeMultimap.create(
Ordering.natural().nullsLast(),
Ordering.usingToString().nullsLast()
);
sorted.putAll(node.values());
for (Map.Entry<String, Expression> entry : sorted.entries()) {
if (!first) {
builder.append(", ");
} else {
first = false;
}
builder.append(formatIdentifier(entry.getKey()))
.append("= ")
.append(entry.getValue().accept(this, context));
}
return builder.append("}").toString();
}
示例2: getRequestContextFromMap
import com.google.common.collect.TreeMultimap; //導入方法依賴的package包/類
private InternalRequestContext getRequestContextFromMap(TreeMultimap<Calendar, ItemInfo> versionsItems,
StoringRepo repo, InternalRequestContext requestContext, ModuleInfo originalModuleInfo,
boolean searchForReleaseVersion) {
RepositoryService repositoryService = ContextHelper.get().getRepositoryService();
for (Map.Entry<Calendar, ItemInfo> entry : versionsItems.entries()) {
ItemInfo item = entry.getValue();
if (!item.isFolder()) {
ModuleInfo itemModuleInfo = repositoryService.getItemModuleInfo(item.getRepoPath());
boolean isIntegration = itemModuleInfo.isIntegration();
boolean matchReleaseSearch = searchForReleaseVersion && !isIntegration;
boolean matchIntegrationSearch = !searchForReleaseVersion && isIntegration;
if (itemModuleInfo.isValid() && (matchReleaseSearch || matchIntegrationSearch)) {
if (areModuleInfosTheSame(originalModuleInfo, itemModuleInfo) && isPropertiesMatch(item,
requestContext.getProperties())) {
return translateRepoRequestContext(requestContext, repo, item.getRelPath());
}
}
}
}
return requestContext;
}
示例3: destructiveUnionSloppy
import com.google.common.collect.TreeMultimap; //導入方法依賴的package包/類
/**
* Return a polygon which is the union of the given polygons; combines
* vertices that form edges that are almost identical, as defined by
* vertexMergeRadius. Note: clears the List!
*/
public static S2Polygon destructiveUnionSloppy(
List<S2Polygon> polygons, S1Angle vertexMergeRadius) {
// Effectively create a priority queue of polygons in order of number of
// vertices. Repeatedly union the two smallest polygons and add the result
// to the queue until we have a single polygon to return.
// map: # of vertices -> polygon
TreeMultimap<Integer, S2Polygon> queue = TreeMultimap.create();
for (S2Polygon polygon : polygons) {
queue.put(polygon.getNumVertices(), polygon);
}
polygons.clear();
Set<Map.Entry<Integer, S2Polygon>> queueSet = queue.entries();
while (queueSet.size() > 1) {
// Pop two simplest polygons from queue.
queueSet = queue.entries();
Iterator<Map.Entry<Integer, S2Polygon>> smallestIter = queueSet.iterator();
Map.Entry<Integer, S2Polygon> smallest = smallestIter.next();
int aSize = smallest.getKey().intValue();
S2Polygon aPolygon = smallest.getValue();
smallestIter.remove();
smallest = smallestIter.next();
int bSize = smallest.getKey().intValue();
S2Polygon bPolygon = smallest.getValue();
smallestIter.remove();
// Union and add result back to queue.
S2Polygon unionPolygon = new S2Polygon();
unionPolygon.initToUnionSloppy(aPolygon, bPolygon, vertexMergeRadius);
int unionSize = aSize + bSize;
queue.put(unionSize, unionPolygon);
// We assume that the number of vertices in the union polygon is the
// sum of the number of vertices in the original polygons, which is not
// always true, but will almost always be a decent approximation, and
// faster than recomputing.
}
if (queue.isEmpty()) {
return new S2Polygon();
} else {
return queue.get(queue.asMap().firstKey()).first();
}
}