List of usage examples for com.google.common.collect Maps newHashMap
public static <K, V> HashMap<K, V> newHashMap()
From source file:tm.TaskServicesManager.java
public TaskServicesManager() { services = Maps.newHashMap(); }
From source file:com.metamx.emitter.core.Emitters.java
public static Emitter create(Properties props, HttpClient httpClient, ObjectMapper jsonMapper, Lifecycle lifecycle) {/* w ww.ja v a 2 s. com*/ Map<String, Object> jsonified = Maps.newHashMap(); if (props.getProperty(LOG_EMITTER_PROP) != null) { jsonified.put("logging", makeLoggingMap(props)); } else if (props.getProperty(HTTP_EMITTER_PROP) != null) { jsonified.put("http", makeHttpMap(props)); } else { throw new ISE("Unknown type of emitter. Please set [%s] or [%s]", LOG_EMITTER_PROP, HTTP_EMITTER_PROP); } return jsonMapper.convertValue(jsonified, EmitterBuilder.class).build(jsonMapper, httpClient, lifecycle); }
From source file:org.auraframework.throwable.quickfix.RemoveBodyQuickFix.java
private static Map<String, Object> createMap(DefDescriptor<?> descriptor, String query) { Map<String, Object> ret = Maps.newHashMap(); ret.put("descriptor", String.format(descriptor.getQualifiedName())); ret.put("query", query); return ret;// w w w . j a v a 2 s . c o m }
From source file:com.cloudy.common.repository.hibernate.type.JsonMap.java
public Map<Object, Object> getMap() { if (map == null) { map = Maps.newHashMap(); } return map; }
From source file:net.diogobohm.timed.api.db.serializer.DBTagSerializer.java
@Override public Map<String, Object> serialize(DBTag object) { Map<String, Object> valueMap = Maps.newHashMap(); valueMap.put("name", object.getName()); return valueMap; }
From source file:org.eclipselabs.recommenders.codesearch.rcp.dslQL2.validation.ValidatorHelper.java
public static Map<String, List<VariableParameterUsage>> getVarParamUsagesByVarName(VariableUsage var) { Map<String, List<VariableParameterUsage>> m = Maps.newHashMap(); for (VariableParameterUsage parUsage : var.parameterUsages) { if (parUsage.targetVariable == null) continue; if (!m.containsKey(parUsage.targetVariable.name)) { m.put(parUsage.targetVariable.name, new ArrayList<VariableParameterUsage>()); }/*from w ww . j a va 2 s .c om*/ m.get(parUsage.targetVariable.name).add(parUsage); } return m; }
From source file:grakn.core.graql.gremlin.spanningtree.graph.SparseWeightedGraph.java
public static SparseWeightedGraph from(Iterable<Node> nodes, Iterable<Weighted<DirectedEdge>> edges) { final Map<Node, Map<Node, Weighted<DirectedEdge>>> incomingEdges = Maps.newHashMap(); for (Weighted<DirectedEdge> edge : edges) { if (!incomingEdges.containsKey(edge.val.destination)) { incomingEdges.put(edge.val.destination, Maps.newHashMap()); }//from w w w.j a va 2 s . c om incomingEdges.get(edge.val.destination).put(edge.val.source, edge); } return new SparseWeightedGraph(ImmutableSet.copyOf(nodes), incomingEdges); }
From source file:io.druid.query.groupby.GroupByQueryRunnerTestHelper.java
public static Iterable<Row> runQuery(QueryRunnerFactory factory, QueryRunner runner, GroupByQuery query) { QueryToolChest toolChest = factory.getToolchest(); QueryRunner theRunner = new FinalizeResultsQueryRunner<>( toolChest.mergeResults(toolChest.preMergeQueryDecoration(runner)), toolChest); Sequence<Row> queryResult = theRunner.run(query, Maps.newHashMap()); return Sequences.toList(queryResult, Lists.<Row>newArrayList()); }
From source file:com.jivesoftware.licenseserver.ActivityStreamServiceFactory.java
public ActivityStreamService build() { Map<String, String> headers = Maps.newHashMap(); headers.put("Accept", "application/json"); headers.put("Content-Type", "application/json"); List<Interceptor> interceptorList = Lists.newLinkedList(); interceptorList.add(new SignedFetchInterceptor()); JAXRSClientFactoryBean sf = new JAXRSClientFactoryBean(); sf.setResourceClass(ActivityStreamService.class); sf.setAddress("https://gateway.jivesoftware.com/gateway/api/activity/v1"); sf.setHeaders(headers);//from w w w . j a va 2 s.c o m sf.setProvider(new JacksonJaxbJsonProvider()); sf.setOutInterceptors(interceptorList); BindingFactoryManager manager = sf.getBus().getExtension(BindingFactoryManager.class); JAXRSBindingFactory factory = new JAXRSBindingFactory(); factory.setBus(sf.getBus()); manager.registerBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID, factory); ActivityStreamService service = sf.create(ActivityStreamService.class); return service; }
From source file:org.apache.tajo.pullserver.HttpUtil.java
/** * It parses a query string into key/value pairs * * @param queryString decoded query string * @return key/value pairs parsed from a given query string * @throws java.io.UnsupportedEncodingException *///from www. j a va 2 s .c om public static Map<String, String> getParamsFromQuery(String queryString) throws UnsupportedEncodingException { String[] queries = queryString.split("&"); Map<String, String> params = Maps.newHashMap(); String[] param; for (String q : queries) { param = q.split("="); params.put(param[0], param[1]); } return params; }