本文整理汇总了Java中com.google.common.collect.ImmutableMap.size方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableMap.size方法的具体用法?Java ImmutableMap.size怎么用?Java ImmutableMap.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableMap
的用法示例。
在下文中一共展示了ImmutableMap.size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStringFromMap
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public static String getStringFromMap(ImmutableMap<String, ImmutableSet<PrivilegeType>> mapSet) {
String result = "";
if (mapSet == null || mapSet.size() == 0) {
return "";
}
boolean isFirst = false;
for(Entry<String, ImmutableSet<PrivilegeType>> ele : mapSet.entrySet()) {
String dbName = ele.getKey();
String privileges = getStringFromArray2(ele.getValue());
if (isFirst) {
result = result + dbName + ": (" + privileges + "); ";
isFirst = false;
} else {
result = result + dbName + ": (" + privileges + "); ";
}
}
return result;
}
示例2: isFieldMappingMissingField
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
/**
* Helper method to find out if the only included fieldmapping metadata is typed NULL, which means
* that type and index exist, but the field did not
*/
private boolean isFieldMappingMissingField(ImmutableMap<String, ImmutableMap<String, ImmutableMap<String, FieldMappingMetaData>>> mappingsByIndex) throws IOException {
if (mappingsByIndex.size() != 1) {
return false;
}
for (ImmutableMap<String, ImmutableMap<String, FieldMappingMetaData>> value : mappingsByIndex.values()) {
for (ImmutableMap<String, FieldMappingMetaData> fieldValue : value.values()) {
for (Map.Entry<String, FieldMappingMetaData> fieldMappingMetaDataEntry : fieldValue.entrySet()) {
if (fieldMappingMetaDataEntry.getValue().isNull()) {
return true;
}
}
}
}
return false;
}
示例3: retexture
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
public ItemLayerModel retexture(ImmutableMap<String, String> textures)
{
ImmutableList.Builder<ResourceLocation> builder = ImmutableList.builder();
for(int i = 0; i < textures.size() + this.textures.size(); i++)
{
if(textures.containsKey("layer" + i))
{
builder.add(new ResourceLocation(textures.get("layer" + i)));
}
else if(i < this.textures.size())
{
builder.add(this.textures.get(i));
}
}
return new ItemLayerModel(builder.build(), overrides);
}
示例4: getTimestampedValues
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@VisibleForTesting
ImmutableList<MetricPoint<V>> getTimestampedValues(Instant timestamp) {
ImmutableMap<ImmutableList<String>, V> values = valuesSupplier.get();
ImmutableList.Builder<MetricPoint<V>> metricPoints = new ImmutableList.Builder<>();
for (Entry<ImmutableList<String>, V> entry : values.entrySet()) {
metricPoints.add(
MetricPoint.create(this, entry.getKey(), timestamp, timestamp, entry.getValue()));
}
cardinality = values.size();
return metricPoints.build();
}
示例5: handleResponseSetIDs
import com.google.common.collect.ImmutableMap; //导入方法依赖的package包/类
@Override
protected void handleResponseSetIDs(final ResponseLinking.Builder responseLinking,
final ImmutableSet<ResponseSet> responseSets,
final ImmutableMap<String, ResponseSet> responseIDs,
final Optional<ImmutableMap.Builder<String, String>> foreignLinkingIdToLocal)
throws IOException {
if (responseSets.size() == responseIDs.size()) {
responseLinking.responseSetIds(ImmutableBiMap.copyOf(responseIDs));
responseLinking.build();
} else if (responseSets.size() > responseIDs.size() || !foreignLinkingIdToLocal.isPresent()) {
throw new IOException("Read " + responseSets.size() + " response sets but "
+ responseIDs.size() + " ID assignments");
} else {
log.warn(
"Warning - converting ResponseSet IDs and saving them, this is almost definitely an error!");
final ImmutableMultimap<ResponseSet, String> responseSetToIds =
responseIDs.asMultimap().inverse();
final LaxImmutableMapBuilder<String, ResponseSet> idsMapB =
MapUtils.immutableMapBuilderAllowingSameEntryTwice();
for (final Map.Entry<ResponseSet, Collection<String>> setAndIds : responseSetToIds.asMap()
.entrySet()) {
final Collection<String> ids = setAndIds.getValue();
final String selectedID =
checkNotNull(getFirst(usingToString().immutableSortedCopy(ids), null));
for (final String oldId : ids) {
log.debug("Selecting id {} for cluster {}", selectedID, oldId);
foreignLinkingIdToLocal.get().put(oldId, selectedID);
idsMapB.put(selectedID, responseIDs.get(oldId));
}
}
responseLinking.responseSetIds(ImmutableBiMap.copyOf(idsMapB.build()));
}
}