List of usage examples for com.google.common.collect Maps newHashMap
public static <K, V> HashMap<K, V> newHashMap()
From source file:org.opendaylight.ovsdb.lib.notation.Row.java
public Row() { this.columns = Maps.newHashMap(); }
From source file:org.auraframework.docs.DocsController.java
@AuraEnabled public static Component getReference(@Key("topic") String topic, @Key("descriptor") String descriptor, @Key("defType") String defType) throws QuickFixException { Map<String, Object> attributes = Maps.newHashMap(); if (topic == null && defType == null && descriptor == null) { // Show an overview topic for orientation. It's similar to topics in // the Help tab and is in the auradocs // namespace. return getTopic("referenceTabTopic"); } else if (topic != null) { return getTopic(topic); } else {/*from w w w. ja va2 s. co m*/ Preconditions.checkNotNull(descriptor); Preconditions.checkNotNull(defType); DefType dt = DefType.valueOf(defType.toUpperCase()); attributes.put("descriptor", descriptor); attributes.put("defType", dt.name()); return Aura.getInstanceService().getInstance("auradocs:def", ComponentDef.class, attributes); } }
From source file:com.zaradai.bloodstone.model.validation.UniqueFlowIdValidator.java
@Override public void validate(Bloodstone bloodstone) throws ModelException { Map<String, Object> uniqueMap = Maps.newHashMap(); for (Flow flow : bloodstone.getFlows().values()) { String key = flow.getId(); if (uniqueMap.containsKey(key)) { throw new ModelException(String.format("Configuration already contains a graph named %s", key)); }//ww w. j a v a2 s . c om uniqueMap.put(key, flow); } }
From source file:org.eclipse.wb.internal.core.model.util.GenericTypeResolverJavaInfo.java
private static Map<String, String> getTypeArguments(JavaInfo javaInfo) throws Exception { Map<String, String> typeArguments = Maps.newHashMap(); ASTNode node = javaInfo.getCreationSupport().getNode(); if (node instanceof ClassInstanceCreation) { ClassInstanceCreation creation = (ClassInstanceCreation) node; if (creation.getType() instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) creation.getType(); ITypeBinding binding = AstNodeUtils.getTypeBinding(parameterizedType); ITypeBinding[] typeParameters_bindings = binding.getTypeDeclaration().getTypeParameters(); ITypeBinding[] typeArguments_bindings = binding.getTypeArguments(); for (int i = 0; i < typeParameters_bindings.length; i++) { ITypeBinding typeParameter = typeParameters_bindings[i]; ITypeBinding typeArgument = typeArguments_bindings[i]; String typeParameterName = typeParameter.getName(); String typeArgumentName = AstNodeUtils.getFullyQualifiedName(typeArgument, true); typeArguments.put(typeParameterName, typeArgumentName); }/* w w w . jav a 2 s .c om*/ } else { Class<?> componentClass = javaInfo.getDescription().getComponentClass(); for (TypeVariable<?> typeParameter : componentClass.getTypeParameters()) { java.lang.reflect.Type[] bounds = typeParameter.getBounds(); Class<?> upperBound = (Class<?>) bounds[0]; String upperBoundName = ReflectionUtils.getCanonicalName(upperBound); typeArguments.put(typeParameter.getName(), upperBoundName); } } } return typeArguments; }
From source file:com.opengamma.web.analytics.formatting.OtcTradeTargetFormatter.java
@Override public Map<String, Object> formatCell(OtcTradeTarget target, ValueSpecification valueSpec, Object inlineKey) { Map<String, Object> results = Maps.newHashMap(); results.put(NAME, target.getName()); results.put(NODE_ID, target.getNodeId().getObjectId()); results.put(POSITION_ID, target.getPositionId().getObjectId()); UniqueId tradeId = target.getTradeId(); if (tradeId != null) { results.put(TRADE_ID, tradeId.getObjectId()); }/* w ww . j a va 2s .c om*/ return results; }
From source file:co.cask.cdap.internal.asm.ByteCodeClassLoader.java
public ByteCodeClassLoader(ClassLoader parent) { super(parent); this.bytecodes = Maps.newHashMap(); this.typeClasses = Maps.newHashMap(); }
From source file:oims.reciptManagement.DetailRecipt.java
static public Map<String, QuantitiedRawMaterial> unSerialize(String recipt) { Map<String, QuantitiedRawMaterial> returnMap = Maps.newHashMap(); String[] rms = recipt.split("|"); for (String entry : rms) { String[] detailInfo = entry.split(":"); QuantitiedRawMaterial tmpRm = new QuantitiedRawMaterial(detailInfo[0], detailInfo[1], detailInfo[2]); returnMap.put(detailInfo[2], tmpRm); }// w ww .j ava 2 s . c o m return returnMap; }
From source file:org.apache.kylin.cube.DimensionRangeInfo.java
public static Map<String, DimensionRangeInfo> mergeRangeMap(DataModelDesc model, Map<String, DimensionRangeInfo> m1, Map<String, DimensionRangeInfo> m2) { if (!m1.keySet().equals(m2.keySet())) { logger.warn("Merging incompatible maps of DimensionRangeInfo, keys in m1 " + m1.keySet() + ", keys in m2 " + m2.keySet()); }// w ww .j av a 2s. c om Map<String, DimensionRangeInfo> result = Maps.newHashMap(); for (String colId : m1.keySet()) { if (!m2.containsKey(colId)) continue; DimensionRangeInfo r1 = m1.get(colId); DimensionRangeInfo r2 = m2.get(colId); DimensionRangeInfo newR; if (r1.getMin() == null && r1.getMax() == null) { newR = r2; // when r1 is all null or has 0 records } else if (r2.getMin() == null && r2.getMax() == null) { newR = r1; // when r2 is all null or has 0 records } else { DataTypeOrder order = model.findColumn(colId).getType().getOrder(); String newMin = order.min(r1.getMin(), r2.getMin()); String newMax = order.max(r1.getMax(), r2.getMax()); newR = new DimensionRangeInfo(newMin, newMax); } result.put(colId, newR); } return result; }
From source file:org.vclipse.configscan.utils.FailureTreeTraverser.java
public FailureTreeTraverser() { visited = Maps.newHashMap(); }
From source file:com.whatlookingfor.modules.sys.utils.DictUtils.java
/** * ???/*w w w .j a v a 2 s .c om*/ * @return */ public static Map<String, Params> getParams() { Map<String, Params> result = (Map<String, Params>) CacheUtils.get(CACHE_PARAM_MAP); if (result == null) { List<Params> list = paramsDao.findList(new Params()); if (list != null && list.size() > 0) { result = Maps.newHashMap(); for (Params params : list) { result.put(params.getParamName(), params); } CacheUtils.put(CACHE_PARAM_MAP, result); } } return result; }