当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableMap.size方法代码示例

本文整理汇总了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;
    
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:21,代码来源:UserProperty.java

示例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;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:21,代码来源:RestGetFieldMappingAction.java

示例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);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:ItemLayerModel.java

示例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();
}
 
开发者ID:google,项目名称:java-monitoring-client-library,代码行数:14,代码来源:VirtualMetric.java

示例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()));
  }
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:36,代码来源:LinkingStoreSource.java


注:本文中的com.google.common.collect.ImmutableMap.size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。