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