本文整理匯總了Java中com.google.common.collect.Multimap.entries方法的典型用法代碼示例。如果您正苦於以下問題:Java Multimap.entries方法的具體用法?Java Multimap.entries怎麽用?Java Multimap.entries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.Multimap
的用法示例。
在下文中一共展示了Multimap.entries方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setOnTransaction
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
private void setOnTransaction(final ConfigTransactionClient ta, final ConfigExecution execution)
throws DocumentedException {
for (Multimap<String, ModuleElementResolved> modulesToResolved : execution.getResolvedXmlElements(ta)
.values()) {
for (Map.Entry<String, ModuleElementResolved> moduleToResolved : modulesToResolved.entries()) {
String moduleName = moduleToResolved.getKey();
ModuleElementResolved moduleElementResolved = moduleToResolved.getValue();
String instanceName = moduleElementResolved.getInstanceName();
InstanceConfigElementResolved ice = moduleElementResolved.getInstanceConfigElementResolved();
EditConfigStrategy strategy = ice.getEditStrategy();
strategy.executeConfiguration(moduleName, instanceName, ice.getConfiguration(), ta,
execution.getServiceRegistryWrapper(ta));
}
}
}
示例2: create
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
private static MediaType create(
String type, String subtype, Multimap<String, String> parameters) {
checkNotNull(type);
checkNotNull(subtype);
checkNotNull(parameters);
String normalizedType = normalizeToken(type);
String normalizedSubtype = normalizeToken(subtype);
checkArgument(
!WILDCARD.equals(normalizedType) || WILDCARD.equals(normalizedSubtype),
"A wildcard type cannot be used with a non-wildcard subtype");
ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
for (Entry<String, String> entry : parameters.entries()) {
String attribute = normalizeToken(entry.getKey());
builder.put(attribute, normalizeParameterValue(attribute, entry.getValue()));
}
MediaType mediaType = new MediaType(normalizedType, normalizedSubtype, builder.build());
// Return one of the constants if the media type is a known type.
return MoreObjects.firstNonNull(KNOWN_TYPES.get(mediaType), mediaType);
}
示例3: handleMisssingInstancesOnTransaction
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
private void handleMisssingInstancesOnTransaction(final ConfigTransactionClient ta, final ConfigExecution execution)
throws DocumentedException {
for (Multimap<String, ModuleElementDefinition> modulesToResolved : execution.getModulesDefinition(ta)
.values()) {
for (Map.Entry<String, ModuleElementDefinition> moduleToResolved : modulesToResolved.entries()) {
String moduleName = moduleToResolved.getKey();
ModuleElementDefinition moduleElementDefinition = moduleToResolved.getValue();
EditConfigStrategy strategy = moduleElementDefinition.getEditStrategy();
strategy.executeConfiguration(moduleName, moduleElementDefinition.getInstanceName(), null, ta,
execution.getServiceRegistryWrapper(ta));
}
}
}
示例4: eval
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
public Object eval(Response response) {
Object value = null;
String data = response.body().asString();
if (bodyAssert.getSelect() != null) {
Multimap<String, List<String>> exps = parsedExpressions(bodyAssert.getSelect());
for (Entry<String, List<String>> entry : exps.entries()) {
if (entry.getKey().toLowerCase().startsWith(ExpressionType.jsonpath.toString().toLowerCase())) {
value = JsonExpression.build(data, entry.getKey(), entry.getValue()).parse();
} else if (entry.getKey().toLowerCase().startsWith(ExpressionType.regex.toString().toLowerCase())) {
value = RegexExpression.build(data, entry.getKey(), entry.getValue()).parse();
} else {
throw new TestException("Expression="+entry.getKey()+" not supported in select=" + bodyAssert.getSelect());
}
data = JsonMapper.toJson(value);
}
}
return value;
}
示例5: collectTestsMatchingConditions
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
private static Set<String> collectTestsMatchingConditions(
DexTool dexTool,
CompilerUnderTest compilerUnderTest,
DexVm dexVm,
CompilationMode mode,
Multimap<String, TestCondition> testConditionsMap) {
Set<String> set = Sets.newHashSet();
for (Map.Entry<String, TestCondition> kv : testConditionsMap.entries()) {
if (kv.getValue().test(dexTool, compilerUnderTest, dexVm, mode)) {
set.add(kv.getKey());
}
}
return set;
}
示例6: removeAttributeModifiers
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
public void removeAttributeModifiers(Multimap<String, AttributeModifier> p_111148_1_)
{
for (Entry<String, AttributeModifier> entry : p_111148_1_.entries())
{
IAttributeInstance iattributeinstance = this.getAttributeInstanceByName((String)entry.getKey());
if (iattributeinstance != null)
{
iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
}
}
}
示例7: applyAttributeModifiers
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
public void applyAttributeModifiers(Multimap<String, AttributeModifier> p_111147_1_)
{
for (Entry<String, AttributeModifier> entry : p_111147_1_.entries())
{
IAttributeInstance iattributeinstance = this.getAttributeInstanceByName((String)entry.getKey());
if (iattributeinstance != null)
{
iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
iattributeinstance.applyModifier((AttributeModifier)entry.getValue());
}
}
}
示例8: putAll
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
@Override
public boolean putAll(Multimap<? extends K, ? extends V> multimap) {
for (Entry<? extends K, ? extends V> e : multimap.entries()) {
value2key.put(e.getValue(), e.getKey());
}
return key2Value.putAll(multimap);
}
示例9: checkCustomPing
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
private void checkCustomPing(IMessage msg) {
if (msg.getChannel().isPrivate() || msg.getAuthor().equals(MCBot.instance.getOurUser())) return;
Multimap<Long, CustomPing> pings = HashMultimap.create();
CommandCustomPing.this.getPingsForGuild(msg.getGuild()).forEach(pings::putAll);
for (Entry<Long, CustomPing> e : pings.entries()) {
if (e.getKey() == msg.getAuthor().getLongID()) {
continue;
}
IUser owner = msg.getGuild().getUserByID(e.getKey());
if (owner == null || !msg.getChannel().getModifiedPermissions(owner).contains(Permissions.READ_MESSAGES)) {
continue;
}
Matcher matcher = e.getValue().getPattern().matcher(msg.getContent());
if (matcher.find()) {
final IPrivateChannel channel = owner.getOrCreatePMChannel();
RequestBuffer.request(() -> {
EmbedObject embed = new EmbedBuilder()
.withAuthorIcon(msg.getAuthor().getAvatarURL())
.withAuthorName("New ping from: " + msg.getAuthor().getDisplayName(msg.getGuild()))
.withTitle(e.getValue().getText())
.withDesc(msg.getContent())
.build();
channel.sendMessage("<#" + msg.getChannel().getStringID() + ">", embed);
return true;
});
}
}
}
示例10: removeAttributeModifiers
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
public void removeAttributeModifiers(Multimap<String, AttributeModifier> modifiers)
{
for (Entry<String, AttributeModifier> entry : modifiers.entries())
{
IAttributeInstance iattributeinstance = this.getAttributeInstanceByName((String)entry.getKey());
if (iattributeinstance != null)
{
iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
}
}
}
示例11: applyAttributeModifiers
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
public void applyAttributeModifiers(Multimap<String, AttributeModifier> modifiers)
{
for (Entry<String, AttributeModifier> entry : modifiers.entries())
{
IAttributeInstance iattributeinstance = this.getAttributeInstanceByName((String)entry.getKey());
if (iattributeinstance != null)
{
iattributeinstance.removeModifier((AttributeModifier)entry.getValue());
iattributeinstance.applyModifier((AttributeModifier)entry.getValue());
}
}
}
示例12: computeSelfCost
import com.google.common.collect.Multimap; //導入方法依賴的package包/類
/**
* Computes the cost honoring column pushdown and relative costs across {@link GroupScan group scans}.
*
* The cost model is a function of row count, column and scan factors. Row count may or may not be precise and is
* obtained from{@link GroupScan#getScanStats(PlannerSettings)}. Column factor is relative to number of columns to
* scan. Scan factor represents the relative cost of making the scan as compared to other scans kinds.
*
* An exact field contributes 1 whole points to column factor. A sub field scan contributes proportionately anywhere
* from (0, 1], weighting subsequent sub fields less through a logarithmic model.
*/
@Override
public RelOptCost computeSelfCost(final RelOptPlanner planner, final RelMetadataQuery mq) {
final List<SchemaPath> columns = getColumns();
final boolean isStarQuery = ColumnUtils.isStarQuery(columns);
final int allColumns = getTable().getRowType().getFieldCount();
final double columnFactor;
if (isStarQuery) {
columnFactor = allColumns;
} else {
double runningFactor = 0;
// Maintain map of root to child segments to determine what fraction of a whole field is projected.
final Multimap<NameSegment, SchemaPath> subFields = HashMultimap.create();
for (final SchemaPath column : columns) {
subFields.put(column.getRootSegment(), column);
}
for (Map.Entry<PathSegment.NameSegment, SchemaPath> entry : subFields.entries()) {
final PathSegment.NameSegment root = entry.getKey();
final SchemaPath field = entry.getValue();
final String rootPath = root.getPath();
final boolean entireColSelected = rootPath.equalsIgnoreCase(field.getAsUnescapedPath());
if (entireColSelected) {
runningFactor += 1;
} else {
final RelDataType dataType = getRowType().getField(rootPath, false, false).getType();
final int subFieldCount = dataType.isStruct() ? dataType.getFieldCount() : 1;
// sandwich impact of this projection between (0, 1]
final double impact = Math.log10(1 + (Math.min(1, subFieldCount/MAX_COLUMNS) * 9));
runningFactor += impact;
}
}
columnFactor = runningFactor;
}
final double estimatedCount = estimateRowCount(mq);
// If the estimatedCount is actually 0, then make it 1, so that at least, we choose the scan that
// has fewer columns pushed down since all the cost scales with rowCount.
final double rowCount = Math.max(1, estimatedCount);
final double scanFactor = getGroupScan().getScanCostFactor().getFactor();
final double cpuCost = rowCount * columnFactor * scanFactor;
final double ioCost = cpuCost;
if (PrelUtil.getSettings(getCluster()).useDefaultCosting()) {
return planner.getCostFactory().makeCost(estimatedCount, cpuCost, ioCost);
}
final double networkCost = ioCost;
// Even though scan is reading from disk, in the currently generated plans all plans will
// need to read the same amount of data, so keeping the disk io cost 0 is ok for now.
// In the future we might consider alternative scans that go against projections or
// different compression schemes etc that affect the amount of data read. Such alternatives
// would affect both cpu and io cost.
final DremioCost.Factory costFactory = (DremioCost.Factory)planner.getCostFactory();
return costFactory.makeCost(estimatedCount, cpuCost, ioCost, networkCost);
}