本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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();
}
示例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();
}
示例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;
}