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


Java LinkedListMultimap.create方法代码示例

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


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

示例1: findClashingMembersByName

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
/**
 * Find clashes by name.
 *
 * @param myPolyMember
 *            current validated Polyfill
 * @param pivotPolyMember
 *            other polyfill in same project
 * @return pairs of contrandicting or same polyfills.
 */
private ListMultimap<TMember, TMember> findClashingMembersByName(EList<TMember> myPolyMember,
		EList<TMember> pivotPolyMember) {
	ListMultimap<TMember, TMember> ret = LinkedListMultimap.create();
	for (TMember my : myPolyMember) {
		String myName = my.getName();
		if (myName == null)
			continue; // broken AST
		for (TMember other : pivotPolyMember) {
			String otherName = other.getName();
			if (myName.equals(otherName)) {
				ret.put(my, other);
			}
		}
	}
	return ret;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:26,代码来源:PolyfillValidatorFragment.java

示例2: readReverse

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
private ListMultimap<String, Thing> readReverse(JsonReader reader) throws IOException {
  reader.beginObject();
  ListMultimap<String, Thing> reverseMap = LinkedListMultimap.create();
  while (reader.hasNext()) {
    String property = reader.nextName();
    JsonToken token = reader.peek();
    if (token == JsonToken.BEGIN_OBJECT) {
      reverseMap.put(property, readObject(reader));
    } else if (token == JsonToken.BEGIN_ARRAY) {
      reader.beginArray();
      while (reader.hasNext()) {
        reverseMap.put(property, readObject(reader));
      }
      reader.endArray();
    } else {
      throw new JsonLdSyntaxException(
          String.format(
              "Invalid value token %s in @reverse. Should be a JSON-LD object or an "
                  + "array of JSON-LD objects",
              token));
    }
  }
  reader.endObject();
  return reverseMap;
}
 
开发者ID:google,项目名称:schemaorg-java,代码行数:26,代码来源:JsonLdSerializer.java

示例3: checkQuotaLimitNamesAreUnique

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
private void checkQuotaLimitNamesAreUnique(Quota quota) {
  ListMultimap<String, QuotaLimit> limitNameCounts = LinkedListMultimap.create();
  for (QuotaLimit limit : quota.getLimitsList()) {
    limitNameCounts.put(limit.getName(), limit);
  }
  for (String limitName : limitNameCounts.keySet()) {
    List<QuotaLimit> limits = limitNameCounts.get(limitName);
    if (limits.size() > 1) {
      error(
          MessageLocationContext.create(Iterables.getLast(limits), "name"),
          "There are %d quota limits with name '%s'.",
          limits.size(),
          limitName);
    }
  }
}
 
开发者ID:googleapis,项目名称:api-compiler,代码行数:17,代码来源:QuotaLimitNameValidator.java

示例4: parseMessage

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
public static final ListMultimap<Integer, String> parseMessage(String baseMsg) {
    ListMultimap<Integer, String> dict = LinkedListMultimap.create();
    char[] baseMsgArray = baseMsg.toCharArray();
    int index = 0;
    for (int i = 0; i < baseMsgArray.length; i++) {
        if (baseMsgArray[i] == 0x01) {
            String fixField = baseMsg.substring(index, i);
            char[] fixFieldArray = fixField.toCharArray();
            for (int j = 0; j < fixFieldArray.length; j++) {
                if (fixFieldArray[j] == '=') {
                    String num = fixField.substring(0, j);
                    int n = Integer.parseInt(num);
                    String val = fixField.substring(j + 1, fixField.length());
                    dict.put(n, val);
                    break;
                }
            }
            index = i + 1;
        }
    }
    return dict;
}
 
开发者ID:globalforge,项目名称:infix,代码行数:23,代码来源:StaticTestingUtils.java

示例5: addSession

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
/**
 * 
 * @param sid
 * @param serverType
 * @param sequence
 * @param localSession
 * @return
 */
public LocalSession addSession(String serverId,String serverType,int sessionId,LocalSession localSession) {
	if (localSession == null) {
		return null;
	}
	localSession.setServerId(serverId);
	localSession.setServerType(serverType);
	localSession.setId(sessionId);
	localSession.setlistener(this.closeListener);
	localSession.setStatus(ISession.STATUS_WORKING);
	sessionBySid.put(serverId, localSession);
	
	synchronized(sessionByStype) {
		LinkedListMultimap<String, LocalSession> multimap = sessionByStype.get(serverType);
		if (multimap == null) {
			multimap = LinkedListMultimap.create();
			sessionByStype.put(serverType, multimap);
		}
		multimap.put(serverId, localSession);
	}
	return localSession;
}
 
开发者ID:qiuhd2015,项目名称:anima,代码行数:30,代码来源:LocalSessionMgr.java

示例6: NewsSearchRenderableDefinition

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
@Inject
public NewsSearchRenderableDefinition(Node content, RD definition, RenderingModel<?> parent, TemplatingFunctions templatingFunctions) {
	super(content, definition, parent);
	this.templatingFunctions = templatingFunctions;
	setWorkspace(NewsRepositoryConstants.COLLABORATION);
	setNodetype(NewsNodeTypes.News.NAME);

	filter = LinkedListMultimap.create();
	Set<String> parameters = webContext.getParameters().keySet();
	for (String parameterKey : parameters) {
		if (allowedParameters().contains(parameterKey)) {
			String[] parameterValues = webContext.getParameterValues(parameterKey);
			for (String parameterValue : parameterValues) {
				if (StringUtils.isNotEmpty(parameterValue)) {
					filter.get(parameterKey).add(parameterValue);
				}
			}
		}
		webContext.remove(parameterKey);
	}
	LOGGER.debug("Running constructor NewsSearchRenderableDefinition");
}
 
开发者ID:tricode,项目名称:magnolia-news,代码行数:23,代码来源:NewsSearchRenderableDefinition.java

示例7: discover

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
AutoRegisterModules discover() throws InvalidPluginException {
  sysSingletons = new HashSet<>();
  sysListen = LinkedListMultimap.create();
  initJs = null;

  sshGen.setPluginName(pluginName);
  httpGen.setPluginName(pluginName);

  scan();

  if (!sysSingletons.isEmpty() || !sysListen.isEmpty() || initJs != null) {
    sysModule = makeSystemModule();
  }
  sshModule = sshGen.create();
  httpModule = httpGen.create();
  return this;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:AutoRegisterModules.java

示例8: computeAspectDependencies

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
@Override
public ImmutableMultimap<Attribute, Label> computeAspectDependencies(Target target,
    DependencyFilter dependencyFilter)
    throws InterruptedException {
  Multimap<Attribute, Label> result = LinkedListMultimap.create();
  if (target instanceof Rule) {
    Multimap<Attribute, Label> transitions =
        ((Rule) target).getTransitions(DependencyFilter.NO_NODEP_ATTRIBUTES);
    for (Entry<Attribute, Label> entry : transitions.entries()) {
      Target toTarget;
      try {
        toTarget = packageProvider.getTarget(eventHandler, entry.getValue());
        result.putAll(
            AspectDefinition.visitAspectsIfRequired(
                target,
                entry.getKey(),
                toTarget,
                dependencyFilter));
      } catch (NoSuchThingException e) {
        // Do nothing. One of target direct deps has an error. The dependency on the BUILD file
        // (or one of the files included in it) will be reported in the query result of :BUILD.
      }
    }
  }
  return ImmutableMultimap.copyOf(result);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:27,代码来源:PreciseAspectResolver.java

示例9: testCopyCredentialToHeaders

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
@Test
public void testCopyCredentialToHeaders() throws IOException {
  ListMultimap<String, String> values = LinkedListMultimap.create();
  values.put("Authorization", "token1");
  values.put("Authorization", "token2");
  values.put("Extra-Authorization", "token3");
  values.put("Extra-Authorization", "token4");
  when(credentials.getRequestMetadata(any(URI.class))).thenReturn(Multimaps.asMap(values));
  ClientCall<String, Integer> interceptedCall =
      interceptor.interceptCall(descriptor, CallOptions.DEFAULT, channel);
  Metadata headers = new Metadata();
  interceptedCall.start(listener, headers);
  assertEquals(listener, call.responseListener);
  assertEquals(headers, call.headers);

  Iterable<String> authorization = headers.getAll(AUTHORIZATION);
  Assert.assertArrayEquals(new String[]{"token1", "token2"},
      Iterables.toArray(authorization, String.class));
  Iterable<String> extraAuthorization = headers.getAll(EXTRA_AUTHORIZATION);
  Assert.assertArrayEquals(new String[]{"token3", "token4"},
      Iterables.toArray(extraAuthorization, String.class));
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:23,代码来源:ClientAuthInterceptorTest.java

示例10: partitionParametersByType

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
private Multimap<Type, VariableTree> partitionParametersByType(
    List<VariableTree> parameters, VisitorState state) {

  Types types = state.getTypes();
  Multimap<Type, VariableTree> multimap = LinkedListMultimap.create();

  variables:
  for (VariableTree node : parameters) {
    // Normalize Integer => int
    Type type = types.unboxedTypeOrType(ASTHelpers.getType(node));
    for (Type existingType : multimap.keySet()) {
      if (types.isSameType(existingType, type)) {
        multimap.put(existingType, node);
        continue variables;
      }
    }

    // A new type for the map.
    multimap.put(type, node);
  }

  return multimap;
}
 
开发者ID:google,项目名称:error-prone,代码行数:24,代码来源:AssistedParameters.java

示例11: testCycleDetection

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
/**
 * Creates the following graph and verifies that the cycle is found.
 * <pre>
 *         A
 *       /   \
 *     B       C <----|
 *   /   \   /        |
 * D       E          |
 *   \   /            |
 *     F --------------
 * </pre>
 * Note that there is a circular dependency from F -> C -> E -> F.
 */
@Test
public void testCycleDetection() throws IOException {
  Multimap<String, String> graph = LinkedListMultimap.create();
  graph.put("A", "B");
  graph.put("A", "C");
  graph.put("B", "D");
  graph.put("B", "E");
  graph.put("C", "E");
  graph.put("D", "F");
  graph.put("E", "F");
  graph.put("F", "C");
  AbstractAcyclicDepthFirstPostOrderTraversal<String> dfs = new TestDagDepthFirstSearch(graph);

  try {
    dfs.traverse(ImmutableList.of("A"));
  } catch (CycleException e) {
    assertEquals("Cycle found: F -> C -> E -> F", e.getMessage());
    assertEquals(ImmutableList.of("F", "C", "E", "F"), e.getCycle());
  }
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:34,代码来源:AbstractAcyclicDepthFirstPostOrderTraversalTest.java

示例12: testCycleExceptionDoesNotContainUnrelatedNodes

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
/**
 * Verifies that the reported cycle mentions only A, B, and D, but not C or E.
 * <pre>
 *         A <---|
 *       /       |
 *     B         |
 *   / | \       |
 * C   D   E     |
 *     |         |
 *     ==========|
 * </pre>
 */
@Test
public void testCycleExceptionDoesNotContainUnrelatedNodes() throws IOException {
  Multimap<String, String> graph = LinkedListMultimap.create();
  graph.put("A", "B");
  graph.put("B", "C");
  graph.put("B", "D");
  graph.put("B", "E");
  graph.put("D", "A");

  TestDagDepthFirstSearch dfs = new TestDagDepthFirstSearch(graph);
  try {
    dfs.traverse(ImmutableList.of("A"));
  } catch (CycleException e) {
    assertEquals("Cycle found: A -> B -> D -> A", e.getMessage());
    assertEquals(ImmutableList.of("A", "B", "D", "A"), e.getCycle());
  }
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:30,代码来源:AbstractAcyclicDepthFirstPostOrderTraversalTest.java

示例13: builderPutAllMultimapWithDuplicates

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
@Test
public void builderPutAllMultimapWithDuplicates() {
  Multimap<String, Integer> toPut = LinkedListMultimap.create();
  toPut.put("foo", 1);
  toPut.put("bar", 4);
  toPut.put("foo", 2);
  toPut.put("foo", 1);
  toPut.put("bar", 5);
  Multimap<String, Integer> moreToPut = LinkedListMultimap.create();
  moreToPut.put("foo", 6);
  moreToPut.put("bar", 4);
  moreToPut.put("foo", 7);
  moreToPut.put("foo", 2);
  ImmutableSortedKeyListMultimap.Builder<String, Integer> builder
      = ImmutableSortedKeyListMultimap.builder();
  builder.putAll(toPut);
  builder.putAll(moreToPut);
  Multimap<String, Integer> multimap = builder.build();
  assertThat(multimap).valuesForKey("foo").containsExactly(1, 2, 1, 6, 7, 2).inOrder();
  assertThat(multimap).valuesForKey("bar").containsExactly(4, 5, 4).inOrder();
  assertThat(multimap).hasSize(9);
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:23,代码来源:ImmutableSortedKeyListMultimapTest.java

示例14: collectSoftwareElementsToMove

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
private Multimap<String, SoftwareElement> collectSoftwareElementsToMove(Set<VariationPoint> vpsToMerge,
        VariationPoint survivingVP) {
    Multimap<String, SoftwareElement> variantSoftwareElements = LinkedListMultimap.create();
    for (VariationPoint vp : vpsToMerge) {

        // skip the surviving vp to not modify the emf elements
        if (survivingVP == vp) {
            continue;
        }

        for (Variant variant : vp.getVariants()) {
            variantSoftwareElements.putAll(variant.getId(), variant.getImplementingElements());
        }
    }
    return variantSoftwareElements;
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:17,代码来源:MergeVariationPointsHandler.java

示例15: invalidBase64

import com.google.common.collect.LinkedListMultimap; //导入方法依赖的package包/类
@Test
public void invalidBase64() throws Exception {
  ListMultimap<String, String> values = LinkedListMultimap.create();
  values.put("Extra-Authorization-bin", "dG9rZW4z1");  // invalid base64
  when(credentials.getRequestMetadata(eq(expectedUri))).thenReturn(Multimaps.asMap(values));

  GoogleAuthLibraryCallCredentials callCredentials =
      new GoogleAuthLibraryCallCredentials(credentials);
  callCredentials.applyRequestMetadata(method, attrs, executor, applier);

  verify(credentials).getRequestMetadata(eq(expectedUri));
  verify(applier).fail(statusCaptor.capture());
  Status status = statusCaptor.getValue();
  assertEquals(Status.Code.UNAUTHENTICATED, status.getCode());
  assertEquals(IllegalArgumentException.class, status.getCause().getClass());
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:17,代码来源:GoogleAuthLibraryCallCredentialsTest.java


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