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


Java LinkedHashMap.putAll方法代碼示例

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


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

示例1: getOriginOfOperand

import java.util.LinkedHashMap; //導入方法依賴的package包/類
private static LinkedHashMap<String, String> getOriginOfOperand(Expression expression) {
    final LinkedHashMap<String, String> map = new LinkedHashMap<>(); // using LinkedHashMap to keep the insertion order
    if (expression.getFirstOperand() instanceof Expression) {
        map.putAll(getOriginOfOperand((Expression) expression.getFirstOperand()));
    } else if (expression.getFirstOperand() instanceof PrimitiveSymbolic) {
        String firstOperand = ((PrimitiveSymbolic)
                expression.getFirstOperand()).getOrigin().toString().substring("{ROOT}:".length());
        if (firstOperand.startsWith("__PARAM") && firstOperand.endsWith("]")) {
            firstOperand = "param" + firstOperand.split("\\[")[1].substring(0, 1);
        }
        map.put(firstOperand,
                expression.getFirstOperand().toString());
    }
    if (expression.getSecondOperand() instanceof Expression) {
        map.putAll(getOriginOfOperand((Expression) expression.getSecondOperand()));
    } else if (expression.getSecondOperand() instanceof PrimitiveSymbolic) {
        String secondOperand = ((PrimitiveSymbolic)
                expression.getSecondOperand()).getOrigin().toString().substring("{ROOT}:".length());
        if (secondOperand.startsWith("__PARAM") && secondOperand.endsWith("]")) {
            secondOperand = "param" + secondOperand.split("\\[")[1].substring(0, 1);
        }
        map.put(secondOperand,
                expression.getSecondOperand().toString());
    }
    return map;
}
 
開發者ID:STAMP-project,項目名稱:Ex2Amplifier,代碼行數:27,代碼來源:JBSERunner.java

示例2: locateRoutes

import java.util.LinkedHashMap; //導入方法依賴的package包/類
@Override
protected Map<String, ZuulRoute> locateRoutes() {
    LinkedHashMap<String, ZuulRoute> routesMap = new LinkedHashMap<>();
    //從application.properties中加載路由信息
    routesMap.putAll(super.locateRoutes());
    //從db中加載路由信息
    routesMap.putAll(getRoutesFromSomewhere());
    //優化一下配置
    LinkedHashMap<String, ZuulRoute> values = new LinkedHashMap<>();
    for (Map.Entry<String, ZuulRoute> entry : routesMap.entrySet()) {
        String path = entry.getKey();
        // Prepend with slash if not already present.
        if (!path.startsWith("/")) {
            path = "/" + path;
        }
        if (StringUtils.hasText(this.properties.getPrefix())) {
            path = this.properties.getPrefix() + path;
            if (!path.startsWith("/")) {
                path = "/" + path;
            }
        }
        values.put(path, entry.getValue());
    }
    log.info("[INFO===>>>]路由信息已更新!");
    return values;
}
 
開發者ID:Paleozoic,項目名稱:spring_cloud_demo,代碼行數:27,代碼來源:CustomRouteLocator.java

示例3: getClassPathEntries

import java.util.LinkedHashMap; //導入方法依賴的package包/類
@VisibleForTesting
static ImmutableMap<File, ClassLoader> getClassPathEntries(ClassLoader classloader) {
  LinkedHashMap<File, ClassLoader> entries = Maps.newLinkedHashMap();
  // Search parent first, since it's the order ClassLoader#loadClass() uses.
  ClassLoader parent = classloader.getParent();
  if (parent != null) {
    entries.putAll(getClassPathEntries(parent));
  }
  if (classloader instanceof URLClassLoader) {
    URLClassLoader urlClassLoader = (URLClassLoader) classloader;
    for (URL entry : urlClassLoader.getURLs()) {
      if (entry.getProtocol().equals("file")) {
        File file = toFile(entry);
        if (!entries.containsKey(file)) {
          entries.put(file, classloader);
        }
      }
    }
  }
  return ImmutableMap.copyOf(entries);
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:22,代碼來源:ClassPath.java

示例4: getHaplotypeMapFromAlleles

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public static void getHaplotypeMapFromAlleles(final List<Allele> alleleList,
                                              final ReferenceContext ref,
                                              final GenomeLoc loc,
                                              final LinkedHashMap<Allele, Haplotype> haplotypeMap) {
    // protect against having an indel too close to the edge of a contig
    if (loc.getStart() <= HAPLOTYPE_SIZE)
        haplotypeMap.clear();
        // check if there is enough reference window to create haplotypes (can be an issue at end of contigs)
    else if (ref.getWindow().getStop() < loc.getStop() + HAPLOTYPE_SIZE)
        haplotypeMap.clear();
    else if (alleleList.isEmpty())
        haplotypeMap.clear();
    else {
        final int eventLength = getEventLength(alleleList);
        final int hsize = ref.getWindow().size() - Math.abs(eventLength) - 1;
        final int numPrefBases = ref.getLocus().getStart() - ref.getWindow().getStart() + 1;

        if (hsize <= 0)  // protect against event lengths larger than ref window sizes
            haplotypeMap.clear();
        else
            haplotypeMap.putAll(Haplotype.makeHaplotypeListFromAlleles(alleleList, loc.getStart(),
                    ref, hsize, numPrefBases));
    }
}
 
開發者ID:PAA-NCIC,項目名稱:SparkSeq,代碼行數:25,代碼來源:IndelGenotypeLikelihoodsCalculationModel.java

示例5: toMap

import java.util.LinkedHashMap; //導入方法依賴的package包/類
protected static final LinkedHashMap<Object, Object> toMap(Object from) {
	LinkedHashMap<Object, Object> map = new LinkedHashMap<Object, Object>();
	if (from instanceof Collection) {
		int count = 0;
		for (Object value : (Collection<?>) from) {
			map.put("key" + count, value);
		}
	} else if (from instanceof Map) {
		map.putAll((Map<?, ?>) from);
	} else if (from.getClass().isArray()) {
		int len = Array.getLength(from);
		for (int i = 0; i < len; i++) {
			map.put("key" + i, Array.get(from, i));
		}
	} else {
		map.put("key", from);
	}
	return map;
}
 
開發者ID:berkesa,項目名稱:datatree,代碼行數:20,代碼來源:AbstractConverterSet.java

示例6: locateRoutes

import java.util.LinkedHashMap; //導入方法依賴的package包/類
@Override
protected LinkedHashMap<String, ZuulRoute> locateRoutes() {
    LinkedHashMap<String, ZuulRoute> routesMap = new LinkedHashMap<String, ZuulRoute>();
    //從application.properties中加載路由信息
    routesMap.putAll(super.locateRoutes());
    //從db中加載路由信息
    routesMap.putAll(locateRoutesFromDB());
    //優化一下配置
    LinkedHashMap<String, ZuulRoute> values = new LinkedHashMap<>();
    for (Map.Entry<String, ZuulRoute> entry : routesMap.entrySet()) {
        String path = entry.getKey();
        // Prepend with slash if not already present.
        if (!path.startsWith("/")) {
            path = "/" + path;
        }
        if (StringUtils.hasText(this.properties.getPrefix())) {
            path = this.properties.getPrefix() + path;
            if (!path.startsWith("/")) {
                path = "/" + path;
            }
        }
        values.put(path, entry.getValue());
    }
    return values;
}
 
開發者ID:xiaomin0322,項目名稱:zuul-gateway,代碼行數:26,代碼來源:CustomRouteLocator.java

示例7: mergePathDefinitions

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public Map<String, Path> mergePathDefinitions(Swagger target, Swagger source) {
	LinkedHashMap<String, Path> mergedDefinitions = new LinkedHashMap<>();
	mergedDefinitions.putAll(target.getPaths());

	Map<String, Path> pathsToBeMerged = source.getPaths();

	for (Entry<String, Path> entry : pathsToBeMerged.entrySet()) {
		if (!mergedDefinitions.containsKey(entry.getKey())) {
			logger.info("source path %s is not present in existing Swagger JSON file.", entry.getKey());
			mergedDefinitions.put(entry.getKey(), entry.getValue());
		} else {
			
			logger.info("source path %s is present in existing Swagger JSON file...merging operations", entry.getKey());
			
			Map<HttpMethod, Operation> modifedOperations = mergeOperationPaths(mergedDefinitions.get(entry.getKey()),
					entry.getValue());
			
			for(Entry<HttpMethod, Operation> operation : modifedOperations.entrySet()){
				mergedDefinitions.get(entry.getKey()).set(operation.getKey().name().toLowerCase(), operation.getValue());
			}				
		}
	}

	return mergedDefinitions;

}
 
開發者ID:pegasystems,項目名稱:api2swagger,代碼行數:27,代碼來源:SwaggerUpdater.java

示例8: mergedModelDefinitions

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public Map<String, Model> mergedModelDefinitions(Swagger target, Swagger source) {
	LinkedHashMap<String, Model> mergedDefinitions = new LinkedHashMap<>();
	
	if(target.getDefinitions() != null ){
		mergedDefinitions.putAll(target.getDefinitions());
	}
	
	if(source.getDefinitions() != null){
		mergedDefinitions.putAll(source.getDefinitions());	
	}
	return mergedDefinitions;
}
 
開發者ID:pegasystems,項目名稱:api2swagger,代碼行數:13,代碼來源:SwaggerUpdater.java

示例9: definition

import java.util.LinkedHashMap; //導入方法依賴的package包/類
private LinkedHashMap<K, V> definition() {
  LinkedHashMap<K, V> result = new LinkedHashMap<>();
  do {
    result.putAll(function());
  } while (lexer.getCurrentToken() == Token.FUNC_NAME);
  return result;
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:8,代碼來源:FunctionParser.java

示例10: getVideoPlayUrl

import java.util.LinkedHashMap; //導入方法依賴的package包/類
public String getVideoPlayUrl(String cid, String aid, String zid, String vid, String uid, String tss, String playid, String tm, String uuid, Map<String, String> adMap) {
    LinkedHashMap<String, String> map = new LinkedHashMap();
    map.put("tm", tm);
    map.put("playid", playid);
    if (TextUtils.equals(tss, "ios")) {
        map.put("tss", tss);
    } else {
        map.put("tss", "no");
    }
    map.put("pcode", LetvConfig.getPcode());
    map.put("version", LetvUtils.getClientVersionName());
    if (!(TextUtils.isEmpty(cid) || TextUtils.equals("0", cid))) {
        map.put("cid", cid);
    }
    if (!(TextUtils.isEmpty(zid) || TextUtils.equals("0", zid))) {
        map.put(PlayConstant.ZID, zid);
    }
    if (!(TextUtils.isEmpty(aid) || TextUtils.equals("0", aid))) {
        map.put("pid", aid);
    }
    if (!(TextUtils.isEmpty(vid) || TextUtils.equals("0", vid))) {
        map.put("vid", vid);
    }
    if (!(TextUtils.isEmpty(uid) || TextUtils.equals("0", uid))) {
        map.put("uid", uid);
    }
    if (!TextUtils.isEmpty(uuid)) {
        map.put("vvid", uuid);
    }
    map.put(HOME_RECOMMEND_PARAMETERS.DEVICEID_KEY, LetvUtils.generateDeviceId(BaseApplication.getInstance()));
    if (!BaseTypeUtils.isMapEmpty(adMap)) {
        map.putAll(adMap);
    }
    return ParameterBuilder.getQueryUrl(map, getPlayUrl());
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:36,代碼來源:MediaAssetApi.java

示例11: visitIfStatement

import java.util.LinkedHashMap; //導入方法依賴的package包/類
@Override
public String visitIfStatement(JavaParser.IfStatementContext ctx) {
	//'if' parExpression statement ('else' statement)?
	LinkedHashMap<String, JavaClass> tempLocalVariables = new LinkedHashMap<>();
	tempLocalVariables.putAll(localVariables);
	currentContext = ctx;
	visit(ctx.parExpression());
	currentContext = null;
	for (JavaParser.StatementContext cx : ctx.statement()) {
		visit(cx);
	}
	localVariables.clear();
	localVariables.putAll(tempLocalVariables);
	return null;
}
 
開發者ID:ghaffarian,項目名稱:progex,代碼行數:16,代碼來源:JavaICFGBuilder.java

示例12: visitDoWhileStatement

import java.util.LinkedHashMap; //導入方法依賴的package包/類
@Override
public String visitDoWhileStatement(JavaParser.DoWhileStatementContext ctx) {
	LinkedHashMap<String, JavaClass> tempLocalVariables = new LinkedHashMap<>();
	tempLocalVariables.putAll(localVariables);
	visit(ctx.statement());
	currentContext = ctx;
	visit(ctx.parExpression());
	currentContext = null;
	localVariables.clear();
	localVariables.putAll(tempLocalVariables);
	return null;
}
 
開發者ID:ghaffarian,項目名稱:progex,代碼行數:13,代碼來源:JavaICFGBuilder.java

示例13: visitForStatement

import java.util.LinkedHashMap; //導入方法依賴的package包/類
@Override
public String visitForStatement(JavaParser.ForStatementContext ctx) {
	// 'for' '(' forControl ')' statement
	//forControl:
	//       enhancedForControl |   forInit? ';' expression? ';' forUpdate?
	//enhancedForControl:variableModifier* typeType variableDeclaratorId ':' expression
	LinkedHashMap<String, JavaClass> tempLocalVariables = new LinkedHashMap<>();
	tempLocalVariables.putAll(localVariables);

	if (ctx.forControl().enhancedForControl() != null) {
		currentContext = ctx.forControl().enhancedForControl();
		visit(ctx.forControl().enhancedForControl());
		currentContext = null;
	} else {
		if (ctx.forControl().forInit() != null) {
			currentContext = ctx.forControl().forInit();
			visitChildren(ctx.forControl().forInit());
			currentContext = null;
		}
		if (ctx.forControl().expression() != null) {
			currentContext = ctx.forControl().expression();
			visit(ctx.forControl().expression());
			currentContext = null;
		}
		if (ctx.forControl().forUpdate() != null) {
			currentContext = ctx.forControl().expression();
			visit(ctx.forControl().forUpdate());
			currentContext = null;
		}
	}
	visit(ctx.statement());

	localVariables.clear();
	localVariables.putAll(tempLocalVariables);
	return null;
}
 
開發者ID:ghaffarian,項目名稱:progex,代碼行數:37,代碼來源:JavaICFGBuilder.java

示例14: visitSynchBlockStatement

import java.util.LinkedHashMap; //導入方法依賴的package包/類
@Override
public String visitSynchBlockStatement(JavaParser.SynchBlockStatementContext ctx) {
	// 'synchronized' parExpression block
	LinkedHashMap<String, JavaClass> tempLocalVariables = new LinkedHashMap<>();
	tempLocalVariables.putAll(localVariables);
	currentContext = ctx;
	visit(ctx.parExpression());
	currentContext = null;
	visit(ctx.block());
	localVariables.clear();
	localVariables.putAll(tempLocalVariables);
	return null;
}
 
開發者ID:ghaffarian,項目名稱:progex,代碼行數:14,代碼來源:JavaICFGBuilder.java

示例15: visitTryStatement

import java.util.LinkedHashMap; //導入方法依賴的package包/類
@Override
public String visitTryStatement(JavaParser.TryStatementContext ctx) {
	// 'try' block (catchClause+ finallyBlock? | finallyBlock)
	LinkedHashMap<String, JavaClass> tempLocalVariables = new LinkedHashMap<>();
	tempLocalVariables.putAll(localVariables);
	visit(ctx.block());
	localVariables.clear();
	localVariables.putAll(tempLocalVariables);

	if (ctx.finallyBlock() != null) {
		// 'finally' block
		tempLocalVariables.clear();
		tempLocalVariables.putAll(localVariables);
		visit(ctx.finallyBlock().block());
		localVariables.clear();
		localVariables.putAll(tempLocalVariables);
	}

	// Now visit any available catch clauses
	if (ctx.catchClause() != null && ctx.catchClause().size() > 0) {
		// 'catch' '(' variableModifier* catchType Identifier ')' block

		for (JavaParser.CatchClauseContext cx : ctx.catchClause()) {
			tempLocalVariables.clear();
			tempLocalVariables.putAll(localVariables);
			String name = cx.Identifier().getText();
			//Assume that the catch type is a simple class name, for now
			String type = cx.catchType().getText();
			localVariables.put(name, findClassbyName(type));
			visit(cx.block());
			localVariables.clear();
			localVariables.putAll(tempLocalVariables);
		}
	}

	return null;
}
 
開發者ID:ghaffarian,項目名稱:progex,代碼行數:38,代碼來源:JavaICFGBuilder.java


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