List of usage examples for com.google.common.collect Maps newLinkedHashMap
public static <K, V> LinkedHashMap<K, V> newLinkedHashMap()
From source file:org.pshdl.model.evaluation.HDLEvaluationContext.java
/** * Generates a default context where all parameter are assumed to be the * constant they are initialized with//from w w w . j a v a 2 s . c om * * @param unit * the unit to create the context for * @return a HDLEvaluationContext with all parameters set to their default */ public static Map<HDLQualifiedName, HDLEvaluationContext> createDefault(HDLPackage pkg) { final Map<HDLQualifiedName, HDLEvaluationContext> res = Maps.newLinkedHashMap(); for (final HDLUnit unit : pkg.getUnits()) { final HDLEvaluationContext hec = createDefault(unit); final HDLQualifiedName fullName = fullNameOf(unit); res.put(fullName, hec); } return res; }
From source file:org.gradle.api.internal.plugins.DefaultConvention.java
@Override public Map<String, Object> getPlugins() { if (plugins == null) { plugins = Maps.newLinkedHashMap(); } return plugins; }
From source file:org.jasig.ssp.dao.security.oauth.OAuth1NonceDao.java
public OAuth1Nonce get(String consumerKey, long timestamp, String nonce) { if (StringUtils.isBlank(nonce) || StringUtils.isBlank(consumerKey)) { throw new IllegalArgumentException("nonce or consumer key can not be empty."); }/*from ww w. j a v a 2 s.c om*/ final Criteria query = sessionFactory.getCurrentSession().createCriteria(OAuth1Nonce.class); final LinkedHashMap<String, Object> predicates = Maps.newLinkedHashMap(); predicates.put("consumerKey", consumerKey); predicates.put("nonceTimestamp", timestamp); predicates.put("nonce", nonce); query.add(Restrictions.allEq(predicates)); return (OAuth1Nonce) query.uniqueResult(); }
From source file:com.opengamma.financial.analytics.model.volatility.surface.black.defaultproperties.FXBlackVolatilitySurfaceDefaults.java
public FXBlackVolatilitySurfaceDefaults(final ComputationTargetType target, final String... defaultsPerCurrencyPair) { super(target, true); ArgumentChecker.notNull(defaultsPerCurrencyPair, "defaults per currency"); final int n = defaultsPerCurrencyPair.length; ArgumentChecker.isTrue(n % 4 == 0,//ww w . j a v a 2 s .co m "Need one forward curve name, forward curve calculation method and surface name per currency pair"); _currencyPairToCurveName = Maps.newLinkedHashMap(); _currencyPairToCurveCalculationMethodName = Maps.newLinkedHashMap(); _currencyPairToSurfaceName = Maps.newLinkedHashMap(); for (int i = 0; i < n; i += 4) { final String currencyPair = defaultsPerCurrencyPair[i]; _currencyPairToCurveName.put(currencyPair, defaultsPerCurrencyPair[i + 1]); _currencyPairToCurveCalculationMethodName.put(currencyPair, defaultsPerCurrencyPair[i + 2]); _currencyPairToSurfaceName.put(currencyPair, defaultsPerCurrencyPair[i + 3]); } }
From source file:org.pshdl.model.types.builtIn.busses.CommonBusCode.java
public static Map<String, Boolean> buildArrayMap(HDLInterface hdi) { final Map<String, Boolean> isArray = Maps.newLinkedHashMap(); for (final HDLVariable var : hdi.getAllObjectsOf(HDLVariable.class, true)) if (var.getDimensions().size() != 0) { isArray.put(var.getName(), true); } else {/*from w w w. j a v a 2s .c o m*/ isArray.put(var.getName(), false); } return isArray; }
From source file:cc.recommenders.evaluation.distribution.calc.F1AndSizeProvider.java
@Override protected Map<String, String> getOptions() { Map<String, String> options = Maps.newLinkedHashMap(); addOptions(options, "", false); addOptions(options, "+DEF", true); return options; }
From source file:com.github.fge.jsonschema.processing.ProcessorSelector.java
/** * Constructor */ public ProcessorSelector() { choices = Maps.newLinkedHashMap(); byDefault = null; }
From source file:util.mybatis.comment.ClassCommentPlugin.java
/** * ?.// ww w . jav a 2 s.c o m * * @param introspectedTable the introspected table * @param topLevelClass the top level class */ public void classGenerated(IntrospectedTable introspectedTable, TopLevelClass topLevelClass) { Map<String, Object> local = Maps.newLinkedHashMap(); local.put("todo", new ClassWrapper(introspectedTable)); local.put("tags", ""); String classComment = CodetemplatesLoader.getInstance().get("typecomment_context"); classComment = VelocityUtils.evaluate(classComment, local); try { List<String> lines = CharStreams.readLines(CharStreams.newReaderSupplier(classComment)); if (lines == null) { return; } boolean isfirst = true; for (String line : lines) { line = line.trim(); if (Strings.isNullOrEmpty(line)) { continue; } if (!isfirst) { line = " " + line; } topLevelClass.addJavaDocLine(line); isfirst = false; } } catch (IOException e) { throw new RuntimeException(e); } }
From source file:com.google.api.server.spi.tools.AnnotationApiConfigGenerator.java
@Override public Map<String, String> generateConfig(ServiceContext serviceContext, Class<?>... serviceClasses) throws ApiConfigException { List<ApiConfig> apiConfigs = Lists.newArrayListWithCapacity(serviceClasses.length); for (Class<?> serviceClass : serviceClasses) { apiConfigs.add(configLoader.loadConfiguration(serviceContext, serviceClass)); }/*ww w . j a va 2 s. c om*/ Map<ApiKey, String> configByApiKey = configWriter.writeConfig(apiConfigs); // This *must* retain the order of configByApiKey so the lily_java_api BUILD rule has // predictable output order. Map<String, String> configByFileName = Maps.newLinkedHashMap(); for (Map.Entry<ApiKey, String> entry : configByApiKey.entrySet()) { configByFileName.put(entry.getKey().getApiString() + "." + configWriter.getFileExtension(), entry.getValue()); } return configByFileName; }
From source file:org.sonar.duplications.algorithm.AbstractAdvancedCloneReporter.java
protected List<ClonePair> reportClonePairs(FileBlockGroup fileBlockGroup) { SortedSet<Block> resourceBlocks = fileBlockGroup.getBlockList(); List<List<Block>> sameHashBlockGroups = getIndexedBlockGroups(fileBlockGroup); //an empty list is needed a the end to report clone at the end of file sameHashBlockGroups.add(new ArrayList<Block>()); Map<String, Map<CloneKey, ClonePair>> prevActiveChains = Maps.newLinkedHashMap(); List<ClonePair> reportedPairs = Lists.newArrayList(); Iterator<Block> blockIterator = resourceBlocks.iterator(); for (List<Block> blockGroup : sameHashBlockGroups) { Map<String, Map<CloneKey, ClonePair>> nextActiveChains = Maps.newLinkedHashMap(); Block origBlock = null;/* ww w .ja v a 2s.c o m*/ if (blockIterator.hasNext()) { origBlock = blockIterator.next(); } for (Block block : blockGroup) { String otherResourceId = block.getResourceId(); Map<CloneKey, ClonePair> nextActiveMap = nextActiveChains.get(otherResourceId); if (nextActiveMap == null) { nextActiveMap = Maps.newTreeMap(); nextActiveChains.put(otherResourceId, nextActiveMap); } Map<CloneKey, ClonePair> prevActiveMap = prevActiveChains.get(otherResourceId); if (prevActiveMap == null) { prevActiveMap = Maps.newTreeMap(); prevActiveChains.put(otherResourceId, prevActiveMap); } processBlock(prevActiveMap, nextActiveMap, origBlock, block); } for (Map<CloneKey, ClonePair> prevActiveMap : prevActiveChains.values()) { reportedPairs.addAll(prevActiveMap.values()); } prevActiveChains = nextActiveChains; } return reportedPairs; }