當前位置: 首頁>>代碼示例>>Java>>正文


Java LinkedListMultimap.keySet方法代碼示例

本文整理匯總了Java中com.google.common.collect.LinkedListMultimap.keySet方法的典型用法代碼示例。如果您正苦於以下問題:Java LinkedListMultimap.keySet方法的具體用法?Java LinkedListMultimap.keySet怎麽用?Java LinkedListMultimap.keySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.LinkedListMultimap的用法示例。


在下文中一共展示了LinkedListMultimap.keySet方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: endVisit

import com.google.common.collect.LinkedListMultimap; //導入方法依賴的package包/類
@Override
public void endVisit(FieldDeclaration node) {
  LinkedListMultimap<Integer, VariableDeclarationFragment> newDeclarations =
      rewriteExtraDimensions(node.getType(), node.getFragments());
  if (newDeclarations != null) {
    List<BodyDeclaration> bodyDecls = TreeUtil.getBodyDeclarations(node.getParent());
    int location = 0;
    while (location < bodyDecls.size() && !node.equals(bodyDecls.get(location))) {
      location++;
    }
    for (Integer dimensions : newDeclarations.keySet()) {
      List<VariableDeclarationFragment> fragments = newDeclarations.get(dimensions);
      FieldDeclaration newDecl = new FieldDeclaration(fragments.get(0));
      newDecl.getFragments().addAll(fragments.subList(1, fragments.size()));
      bodyDecls.add(++location, newDecl);
    }
  }
}
 
開發者ID:Sellegit,項目名稱:j2objc,代碼行數:19,代碼來源:Rewriter.java

示例2: broadcast

import com.google.common.collect.LinkedListMultimap; //導入方法依賴的package包/類
/**
 * 廣播消息到指定服務器上
 * @param stype		服務器類型
 * @param message   消息
 */
public void broadcast(String stype,Broadcast message) {
	LinkedListMultimap<String, LocalSession> sessionMap =  sessionByStype.get(stype);
	if (sessionMap == null) {
		logger.error("Failed to broadcast message:" + message,new IllegalStateException("Could not found the fronent server with type " + stype));
		return ;
	}
	for (String serverId : sessionMap.keySet()) {
		LocalSession session = getSessionById(serverId);
		if (session != null) {
			session.send(message);
		}
	}
}
 
開發者ID:qiuhd2015,項目名稱:anima,代碼行數:19,代碼來源:LocalSessionMgr.java

示例3: canonicalizeXiaomiHeaders

import com.google.common.collect.LinkedListMultimap; //導入方法依賴的package包/類
static String canonicalizeXiaomiHeaders(
    LinkedListMultimap<String, String> headers) {
  if (headers == null) {
    return "";
  }

  // 1. Sort the header and merge the values
  Map<String, String> sortedHeaders = new TreeMap<String, String>();
  for (String key : headers.keySet()) {
    if (!key.toLowerCase().startsWith(HttpKeys.XIAOMI_HEADER_PREFIX)) {
      continue;
    }

    StringBuilder builder = new StringBuilder();
    int index = 0;
    for (String value : headers.get(key)) {
      if (index != 0) {
        builder.append(",");
      }
      builder.append(value);
      index++;
    }
    sortedHeaders.put(key, builder.toString());
  }

  // 3. Generate the canonicalized result
  StringBuilder result = new StringBuilder();
  for (Entry<String, String> entry : sortedHeaders.entrySet()) {
    result.append(entry.getKey()).append(":")
        .append(entry.getValue()).append("\n");
  }
  return result.toString();
}
 
開發者ID:XiaoMi,項目名稱:galaxy-sdk-java,代碼行數:34,代碼來源:Signer.java

示例4: canonicalizeResource

import com.google.common.collect.LinkedListMultimap; //導入方法依賴的package包/類
static String canonicalizeResource(URI uri) {
  StringBuilder result = new StringBuilder();
  result.append(uri.getPath());

  // 1. Parse and sort subresources
  TreeMap<String, String> sortedParams = new TreeMap<String, String>();
  LinkedListMultimap<String, String> params = parseUriParameters(uri);
  for (String key : params.keySet()) {
    for (String value : params.get(key)) {
      if (SUB_RESOURCE_SET.contains(key)) {
        sortedParams.put(key, value);
      }
    }
  }

  // 2. Generate the canonicalized result
  if (!sortedParams.isEmpty()) {
    result.append("?");
    boolean isFirst = true;
    for (Entry<String, String> entry : sortedParams.entrySet()) {
      if (isFirst) {
        isFirst = false;
        result.append(entry.getKey());
      } else {
        result.append("&").append(entry.getKey());
      }

      if (!entry.getValue().isEmpty()) {
        result.append("=").append(entry.getValue());
      }
    }
  }
  return result.toString();
}
 
開發者ID:XiaoMi,項目名稱:galaxy-sdk-java,代碼行數:35,代碼來源:Signer.java

示例5: createMatchElementsForBestMatches

import com.google.common.collect.LinkedListMultimap; //導入方法依賴的package包/類
/**
 * Create match elements for valid best matching pairs.
 *
 * For the best match of each left resource, create a match element if this match-pair is also
 * best available match for the right resource in the pair.
 *
 * This supports original resources matched to one or more new resources.<br>
 * This is required to support renaming and derived copies as described in the according Jira
 * Issue:<br>
 * SPLEVO-181 for details {@link https://sdqbuild.ipd.kit.edu/jira/browse/SPLEVO-181}
 *
 * TODO: Check if a match should be prevented if it is only 1<br>
 * 1 means only the filename is the same. The resources are expected to be located relative
 * folders and the URI is an absolute uri. On the other hand, the path to the root folder might
 * be different.<br>
 * subfolderleft/resource.xmi vs. differentsubfolder/resource.xmi<br>
 * vs.<br>
 * rootfolderlef/resource.xmi vs rootsfolderright/resource.xmi<br>
 *
 * @param bestMatchCountIndex
 *            The best match qualifiers for each resource (left and right).
 * @param bestMatchIndexLeft
 *            The pairs of best matches for the left resource.
 * @return The valid resource matches identified.
 */
private List<MatchResource> createMatchElementsForBestMatches(HashMap<Resource, Integer> bestMatchCountIndex,
        LinkedListMultimap<Resource, Resource> bestMatchIndexLeft) {
    List<MatchResource> mappings = Lists.newArrayList();

    for (Resource leftRes : bestMatchIndexLeft.keySet()) {

        List<Resource> rightRessources = bestMatchIndexLeft.get(leftRes);

        for (Resource rightRes : rightRessources) {
            if (bestMatchCountIndex.get(leftRes) == bestMatchCountIndex.get(rightRes)) {
                mappings.add(createMatchResource(leftRes, rightRes, null));
                removeFromIndex(filenameResourcesIndexLeft, leftRes);
                removeFromIndex(filenameResourcesIndexRight, rightRes);
            }
        }
    }

    mappings = filterDuplicateMappings(mappings);

    return mappings;
}
 
開發者ID:kopl,項目名稱:SPLevo,代碼行數:47,代碼來源:HierarchicalStrategyResourceMatcher.java


注:本文中的com.google.common.collect.LinkedListMultimap.keySet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。