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


Java Maps.uniqueIndex方法代码示例

本文整理汇总了Java中com.google.common.collect.Maps.uniqueIndex方法的典型用法代码示例。如果您正苦于以下问题:Java Maps.uniqueIndex方法的具体用法?Java Maps.uniqueIndex怎么用?Java Maps.uniqueIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.collect.Maps的用法示例。


在下文中一共展示了Maps.uniqueIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AbstractStructSchema

import com.google.common.collect.Maps; //导入方法依赖的package包/类
public AbstractStructSchema(
    ModelType<T> type,
    Iterable<ModelProperty<?>> properties,
    Iterable<WeaklyTypeReferencingMethod<?, ?>> nonPropertyMethods,
    Iterable<ModelSchemaAspect> aspects
) {
    super(type);
    ImmutableSortedMap.Builder<String, ModelProperty<?>> builder = ImmutableSortedMap.naturalOrder();
    for (ModelProperty<?> property : properties) {
        builder.put(property.getName(), property);
    }
    this.properties = builder.build();
    this.nonPropertyMethods = ImmutableSet.copyOf(nonPropertyMethods);
    this.aspects = Maps.uniqueIndex(aspects, new Function<ModelSchemaAspect, Class<? extends ModelSchemaAspect>>() {
        @Override
        public Class<? extends ModelSchemaAspect> apply(ModelSchemaAspect aspect) {
            return aspect.getClass();
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:AbstractStructSchema.java

示例2: sortMemgraphObjectsByResultOrder

import com.google.common.collect.Maps; //导入方法依赖的package包/类
private <T extends MemgraphObject> Iterable<T> sortMemgraphObjectsByResultOrder(Iterable<T> MemgraphObjects, List<String> ids) {
    ImmutableMap<String, T> itemMap = Maps.uniqueIndex(MemgraphObjects, MemgraphObject -> {
        if (MemgraphObject instanceof Element) {
            return ((Element) MemgraphObject).getId();
        } else if (MemgraphObject instanceof ExtendedDataRow) {
            return ElasticsearchExtendedDataIdUtils.toDocId(((ExtendedDataRow) MemgraphObject).getId());
        } else {
            throw new MemgraphException("Unhandled searchable item type: " + MemgraphObject.getClass().getName());
        }
    });

    List<T> results = new ArrayList<>();
    for (String id : ids) {
        T item = itemMap.get(id);
        if (item != null) {
            results.add(item);
        }
    }
    return results;
}
 
开发者ID:mware-solutions,项目名称:memory-graph,代码行数:21,代码来源:ElasticsearchSearchQueryBase.java

示例3: InsertFromSubQueryAnalyzedStatement

import com.google.common.collect.Maps; //导入方法依赖的package包/类
public InsertFromSubQueryAnalyzedStatement(AnalyzedRelation subQueryRelation,
                                           DocTableInfo tableInfo,
                                           List<Reference> targetColumns,
                                           @Nullable Map<Reference, Symbol> onDuplicateKeyAssignments) {
    this.targetTable = tableInfo;
    this.subQueryRelation = subQueryRelation;
    this.onDuplicateKeyAssignments = onDuplicateKeyAssignments;
    this.targetColumns = targetColumns;
    Map<ColumnIdent, Integer> columnPositions = toPositionMap(targetColumns);

    clusteredByIdx = MoreObjects.firstNonNull(columnPositions.get(tableInfo.clusteredBy()), -1);
    ImmutableMap<ColumnIdent, GeneratedReferenceInfo> generatedColumns =
            Maps.uniqueIndex(tableInfo.generatedColumns(), ReferenceInfo.TO_COLUMN_IDENT);

    if (tableInfo.hasAutoGeneratedPrimaryKey()) {
        this.primaryKeySymbols = Collections.emptyList();
    } else {
        this.primaryKeySymbols = symbolsFromTargetColumnPositionOrGeneratedExpression(
                columnPositions, targetColumns, tableInfo.primaryKey(), generatedColumns);
    }
    this.partitionedBySymbols = symbolsFromTargetColumnPositionOrGeneratedExpression(
            columnPositions, targetColumns, tableInfo.partitionedBy(), generatedColumns);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:24,代码来源:InsertFromSubQueryAnalyzedStatement.java

示例4: KubeCloudClient

import com.google.common.collect.Maps; //导入方法依赖的package包/类
public KubeCloudClient(@Nullable String serverUuid,
                       @NotNull String cloudProfileId,
                       @NotNull KubeApiConnector apiConnector,
                       @NotNull List<KubeCloudImage> images,
                       @NotNull KubeCloudClientParametersImpl kubeClientParams,
                       @NotNull BuildAgentPodTemplateProviders podTemplateProviders,
                       @NotNull KubeDataCache cache,
                       @NotNull KubeBackgroundUpdater updater) {
    myServerUuid = serverUuid;
    myCloudProfileId = cloudProfileId;
    myApiConnector = apiConnector;
    myImageIdToImageMap = new ConcurrentHashMap<>(Maps.uniqueIndex(images, CloudImage::getId));
    myKubeClientParams = kubeClientParams;
    myPodTemplateProviders = podTemplateProviders;
    myCache = cache;
    myUpdater = updater;
    myUpdater.registerClient(this);
}
 
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:19,代码来源:KubeCloudClient.java

示例5: onRepositoryChange

import com.google.common.collect.Maps; //导入方法依赖的package包/类
@Override
public synchronized void onRepositoryChange(String namespace, Properties newProperties) {
  if (newProperties.equals(m_configProperties)) {
    return;
  }
  Properties newConfigProperties = new Properties();
  newConfigProperties.putAll(newProperties);

  List<ConfigChange>
      changes =
      calcPropertyChanges(namespace, m_configProperties, newConfigProperties);
  Map<String, ConfigChange> changeMap = Maps.uniqueIndex(changes,
      new Function<ConfigChange, String>() {
        @Override
        public String apply(ConfigChange input) {
          return input.getPropertyName();
        }
      });

  m_configProperties = newConfigProperties;
  clearConfigCache();

  this.fireConfigChange(new ConfigChangeEvent(m_namespace, changeMap));

  Tracer.logEvent("Apollo.Client.ConfigChanges", m_namespace);
}
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:27,代码来源:SimpleConfig.java

示例6: indexBySignature

import com.google.common.collect.Maps; //导入方法依赖的package包/类
private static ImmutableMap<Wrapper<Method>, WeaklyTypeReferencingMethod<?, ?>> indexBySignature(Iterable<WeaklyTypeReferencingMethod<?, ?>> methods) {
    return Maps.uniqueIndex(methods, new Function<WeaklyTypeReferencingMethod<?, ?>, Wrapper<Method>>() {
        @Override
        public Wrapper<Method> apply(WeaklyTypeReferencingMethod<?, ?> weakMethod) {
            return SIGNATURE_EQUIVALENCE.wrap(weakMethod.getMethod());
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DefaultStructBindingsStore.java

示例7: configureRoot

import com.google.common.collect.Maps; //导入方法依赖的package包/类
public void configureRoot(Project rootProject) {
    Set<Project> projects = Sets.filter(rootProject.getAllprojects(), HAS_ECLIPSE_PLUGIN);
    ImmutableMap<EclipseProject, Project> eclipseProjects = Maps.uniqueIndex(projects, GET_ECLIPSE_PROJECT);
    HierarchicalElementDeduplicator<EclipseProject> deduplicator = new HierarchicalElementDeduplicator<EclipseProject>(new EclipseDeduplicationAdapter(eclipseProjects));
    Map<EclipseProject, String> deduplicated = deduplicator.deduplicate(eclipseProjects.keySet());
    for (Map.Entry<EclipseProject, String> entry : deduplicated.entrySet()) {
        entry.getKey().setName(entry.getValue());
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:EclipseNameDeduper.java

示例8: DefaultTaskClassValidatorExtractor

import com.google.common.collect.Maps; //导入方法依赖的package包/类
public DefaultTaskClassValidatorExtractor(Iterable<? extends PropertyAnnotationHandler> customAnnotationHandlers) {
    Iterable<PropertyAnnotationHandler> allAnnotationHandlers = Iterables.concat(HANDLERS, customAnnotationHandlers);
    this.annotationHandlers = Maps.uniqueIndex(allAnnotationHandlers, new Function<PropertyAnnotationHandler, Class<? extends Annotation>>() {
        @Override
        public Class<? extends Annotation> apply(PropertyAnnotationHandler handler) {
            return handler.getAnnotationType();
        }
    });
    this.annotationOverrides = collectAnnotationOverrides(allAnnotationHandlers);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:DefaultTaskClassValidatorExtractor.java

示例9: copyFallingBackTo

import com.google.common.collect.Maps; //导入方法依赖的package包/类
/**
 * Takes this AnswerKey as ground truth, and takes unannotated or assessed Responses in fallback
 * and adds them to the AnswerKey.
 *
 * If the CAS for an AssessedResponse is known, prefer that CAS to the CAS in fallback.
 *
 * Does not handle the case where the fallback AnswerKey has an Assessment that this AnswerKey
 * does not.
 */
public AnswerKey copyFallingBackTo(AnswerKey fallback) {
  final Builder ret = modifiedCopyBuilder();

  final ImmutableMap<String, Response> unannotatedHere = Maps.uniqueIndex(unannotatedResponses(),
      ResponseFunctions.uniqueIdentifier());
  final ImmutableMap<String, AssessedResponse> idToAssessedHere =
      Maps.uniqueIndex(annotatedResponses(),
          Functions.compose(ResponseFunctions.uniqueIdentifier(),
              AssessedResponseFunctions.response()));
  final Set<String> idsHere = Sets.union(unannotatedHere.keySet(), idToAssessedHere.keySet());

  final ImmutableMap<String, Response> unannotatedThere = Maps.uniqueIndex(
      fallback.unannotatedResponses(), ResponseFunctions.uniqueIdentifier());
  final ImmutableMap<String, AssessedResponse> idToAssessedThere =
      Maps.uniqueIndex(fallback.annotatedResponses(),
          Functions.compose(ResponseFunctions.uniqueIdentifier(),
              AssessedResponseFunctions.response()));
  final Set<String> idsThere = Sets.union(unannotatedThere.keySet(), idToAssessedThere.keySet());

  final Set<String> idsOnlyInFallback = Sets.difference(idsThere, idsHere);
  for (final String id : idsOnlyInFallback) {
    if (unannotatedThere.containsKey(id)) {
      ret.addUnannotated(unannotatedThere.get(id));
    }
    if (idToAssessedThere.containsKey(id)) {
      final AssessedResponse r = idToAssessedThere.get(id);
      final int CASGroup;
      if (corefAnnotation().CASesToIDs().containsKey(r.response().canonicalArgument())) {
        CASGroup = corefAnnotation().CASesToIDs().get(r.response().canonicalArgument());
      } else {
        CASGroup = fallback.corefAnnotation().CASesToIDs().get(r.response().canonicalArgument());
      }
      ret.addAnnotated(r, CASGroup);
    }
  }
  return ret.build();
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:47,代码来源:AnswerKey.java

示例10: getFieldMap

import com.google.common.collect.Maps; //导入方法依赖的package包/类
private Map<String, Field> getFieldMap(List<Field> fields) {
  Map<String, Field> fieldMap = Maps.uniqueIndex(fields, new Function<Field, String>() {
    @Override
    public String apply(Field field) {
      if (field.isAnnotationPresent(XStreamAlias.class)) {
        return field.getAnnotation(XStreamAlias.class).value();
      }
      return field.getName();
    }
  });
  return fieldMap;
}
 
开发者ID:11590692,项目名称:Wechat-Group,代码行数:13,代码来源:WxPayOrderNotifyResultConverter.java

示例11: AppServiceDomainImpl

import com.google.common.collect.Maps; //导入方法依赖的package包/类
AppServiceDomainImpl(String name, DomainInner innerObject, AppServiceManager manager) {
    super(name, innerObject, manager);
    inner().withLocation("global");
    if (inner().managedHostNames() != null) {
        this.hostNameMap = Maps.uniqueIndex(inner().managedHostNames(), new Function<HostName, String>() {
            @Override
            public String apply(HostName input) {
                return input.name();
            }
        });
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:13,代码来源:AppServiceDomainImpl.java

示例12: entityMaps

import com.google.common.collect.Maps; //导入方法依赖的package包/类
/**
 * 根据实体记录,输出Map<Long id,K extend BaseEntity>集合
 * @param list
 * @return
 */
public static<V extends AbstractIntegerEntity> Map<Integer,V> entityMaps(List<V> list){
        Map<Integer,V> maps = Maps.uniqueIndex(list.iterator(),  new Function<V, Integer>() {
        @Override
        public Integer apply(V entity) {
            return entity.getId();
        }
    });
    return maps;
}
 
开发者ID:jartisan2001,项目名称:parent,代码行数:15,代码来源:AbstractIntegerEntity.java

示例13: entityMaps

import com.google.common.collect.Maps; //导入方法依赖的package包/类
/**
 * 根据实体记录,输出Map<Long id,K extend BaseEntity>集合
 * @param list
 * @return
 */
public static<V extends AbstractLongEntity> Map<Long,V> entityMaps(List<V> list){
        Map<Long,V> maps = Maps.uniqueIndex(list.iterator(),  new Function<V, Long>() {
        @Override
        public Long apply(V entity) {
            return entity.getId();
        }
    });
    return maps;
}
 
开发者ID:jartisan2001,项目名称:parent,代码行数:15,代码来源:AbstractLongEntity.java

示例14: entityMaps

import com.google.common.collect.Maps; //导入方法依赖的package包/类
/**
 * 根据实体记录,输出Map<Long id,K extend BaseEntity>集合
 * @param list
 * @return
 */
public static<V extends AbstractStringEntity> Map<String,V> entityMaps(List<V> list){
        Map<String,V> maps = Maps.uniqueIndex(list.iterator(),  new Function<V, String>() {
        @Override
        public String apply(V entity) {
            return entity.getId();
        }
    });
    return maps;
}
 
开发者ID:jartisan2001,项目名称:parent,代码行数:15,代码来源:AbstractStringEntity.java

示例15: forCohorts

import com.google.common.collect.Maps; //导入方法依赖的package包/类
static ReconnectForwarder forCohorts(final ConnectedClientConnection<?> successor,
        final Collection<HistoryReconnectCohort> cohorts) {
    return new BouncingReconnectForwarder(successor, Maps.uniqueIndex(Collections2.transform(cohorts,
        HistoryReconnectCohort::getProxy), ProxyReconnectCohort::getIdentifier));
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:BouncingReconnectForwarder.java


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