List of usage examples for com.google.common.collect Maps newHashMap
public static <K, V> HashMap<K, V> newHashMap()
From source file:com.mysema.query.sql.spatial.SpatialTemplatesSupport.java
public static Map<Operator<?>, String> getSpatialOps(String prefix, boolean asFunction) { Map<Operator<?>, String> ops = Maps.newHashMap(); ops.put(SpatialOps.AREA, createSpatial(prefix + "Area", 1, asFunction)); ops.put(SpatialOps.AREA2, createSpatial(prefix + "Area", 2, asFunction)); ops.put(SpatialOps.AS_BINARY, createSpatial(prefix + "AsBinary", 1, asFunction)); ops.put(SpatialOps.AS_TEXT, createSpatial(prefix + "AsText", 1, asFunction)); ops.put(SpatialOps.BOUNDARY, createSpatial(prefix + "Boundary", 1, asFunction)); ops.put(SpatialOps.BUFFER, createSpatial(prefix + "Buffer", 2, asFunction)); ops.put(SpatialOps.BUFFER2, createSpatial(prefix + "Buffer", 3, asFunction)); ops.put(SpatialOps.CENTROID, createSpatial(prefix + "Centroid", 1, asFunction)); ops.put(SpatialOps.CONTAINS, createSpatial(prefix + "Contains", 2, asFunction)); ops.put(SpatialOps.CONVEXHULL, createSpatial(prefix + "ConvexHull", 1, asFunction)); ops.put(SpatialOps.CROSSES, createSpatial(prefix + "Crosses", 2, asFunction)); ops.put(SpatialOps.DIFFERENCE, createSpatial(prefix + "Difference", 2, asFunction)); ops.put(SpatialOps.DIMENSION, createSpatial(prefix + "Dimension", 1, asFunction)); ops.put(SpatialOps.DISJOINT, createSpatial(prefix + "Disjoint", 2, asFunction)); ops.put(SpatialOps.DISTANCE, createSpatial(prefix + "Distance", 2, asFunction)); ops.put(SpatialOps.DISTANCE2, createSpatial(prefix + "Distance", 3, asFunction)); ops.put(SpatialOps.END_POINT, createSpatial(prefix + "EndPoint", 1, asFunction)); ops.put(SpatialOps.ENVELOPE, createSpatial(prefix + "Envelope", 1, asFunction)); ops.put(SpatialOps.EQUALS, createSpatial(prefix + "Equals", 2, asFunction)); ops.put(SpatialOps.EXTERIOR_RING, createSpatial(prefix + "ExteriorRing", 1, asFunction)); ops.put(SpatialOps.EXTERIOR_RING2, createSpatial(prefix + "ExteriorRing", 2, asFunction)); ops.put(SpatialOps.GEOMETRIES, createSpatial(prefix + "Geometries", 1, asFunction)); ops.put(SpatialOps.GEOMETRY_TYPE, createSpatial(prefix + "GeometryType", 1, asFunction)); ops.put(SpatialOps.GEOMETRYN, createSpatial(prefix + "GeometryN", 2, asFunction)); ops.put(SpatialOps.INTERIOR_RINGN, createSpatial(prefix + "InteriorRingN", 2, asFunction)); ops.put(SpatialOps.INTERIOR_RINGS, createSpatial(prefix + "InteriorRings", 1, asFunction)); ops.put(SpatialOps.INTERIOR_RINGS2, createSpatial(prefix + "InteriorRings", 2, asFunction)); ops.put(SpatialOps.INTERSECTION, createSpatial(prefix + "Intersection", 2, asFunction)); ops.put(SpatialOps.INTERSECTS, createSpatial(prefix + "Intersects", 2, asFunction)); ops.put(SpatialOps.IS_CLOSED, createSpatial(prefix + "IsClosed", 1, asFunction)); ops.put(SpatialOps.IS_EMPTY, createSpatial(prefix + "IsEmpty", 1, asFunction)); ops.put(SpatialOps.IS_RING, createSpatial(prefix + "IsRing", 1, asFunction)); ops.put(SpatialOps.IS_SIMPLE, createSpatial(prefix + "IsSimple", 1, asFunction)); ops.put(SpatialOps.LENGTH, createSpatial(prefix + "Length", 1, asFunction)); ops.put(SpatialOps.LENGTH2, createSpatial(prefix + "Length", 2, asFunction)); ops.put(SpatialOps.M, createSpatial(prefix + "M", 1, asFunction)); ops.put(SpatialOps.M2, createSpatial(prefix + "M", 2, asFunction)); ops.put(SpatialOps.NUM_GEOMETRIES, createSpatial(prefix + "NumGeometries", 1, asFunction)); ops.put(SpatialOps.NUM_INTERIOR_RING, createSpatial(prefix + "NumInteriorRing", 1, asFunction)); ops.put(SpatialOps.NUM_POINTS, createSpatial(prefix + "NumPoints", 1, asFunction)); ops.put(SpatialOps.NUM_SURFACES, createSpatial(prefix + "NumSurfaces", 1, asFunction)); ops.put(SpatialOps.OVERLAPS, createSpatial(prefix + "Overlaps", 2, asFunction)); ops.put(SpatialOps.POINT_ON_SURFACE, createSpatial(prefix + "PointOnSurface", 1, asFunction)); ops.put(SpatialOps.POINTN, createSpatial(prefix + "PointN", 2, asFunction)); ops.put(SpatialOps.RELATE, createSpatial(prefix + "Relate", 3, asFunction)); ops.put(SpatialOps.SRID, createSpatial(prefix + "SRID", 1, asFunction)); ops.put(SpatialOps.SRID2, createSpatial(prefix + "SRID", 2, asFunction)); ops.put(SpatialOps.START_POINT, createSpatial(prefix + "StartPoint", 1, asFunction)); ops.put(SpatialOps.SURFACE, createSpatial(prefix + "Surface", 1, asFunction)); // XXX ops.put(SpatialOps.SYMDIFFERENCE, createSpatial(prefix + "SymDifference", 2, asFunction)); ops.put(SpatialOps.TOUCHES, createSpatial(prefix + "Touches", 2, asFunction)); ops.put(SpatialOps.TRANSFORM, createSpatial(prefix + "Transform", 2, asFunction)); ops.put(SpatialOps.UNION, createSpatial(prefix + "Union", 2, asFunction)); ops.put(SpatialOps.WITHIN, createSpatial(prefix + "Within", 2, asFunction)); ops.put(SpatialOps.WKBTOSQL, createSpatial(prefix + "WKBToSQL", 2, asFunction)); ops.put(SpatialOps.WKTTOSQL, createSpatial(prefix + "WKTToSQL", 2, asFunction)); ops.put(SpatialOps.X, createSpatial(prefix + "X", 1, asFunction)); ops.put(SpatialOps.X2, createSpatial(prefix + "X", 2, asFunction)); ops.put(SpatialOps.Y, createSpatial(prefix + "Y", 1, asFunction)); ops.put(SpatialOps.Y2, createSpatial(prefix + "Y", 2, asFunction)); ops.put(SpatialOps.Z, createSpatial(prefix + "Z", 1, asFunction)); ops.put(SpatialOps.Z2, createSpatial(prefix + "Z", 2, asFunction)); // extensions ops.put(SpatialOps.AS_EWKT, createSpatial(prefix + "AsEWKT", 1, asFunction)); ops.put(SpatialOps.GEOM_FROM_TEXT, createSpatial(prefix + "GeomFromText", 1, asFunction)); ops.put(SpatialOps.SET_SRID, createSpatial(prefix + "SetSRID", 2, asFunction)); ops.put(SpatialOps.XMIN, createSpatial(prefix + "XMin", 1, asFunction)); ops.put(SpatialOps.XMAX, createSpatial(prefix + "XMax", 1, asFunction)); ops.put(SpatialOps.YMIN, createSpatial(prefix + "YMin", 1, asFunction)); ops.put(SpatialOps.YMAX, createSpatial(prefix + "YMax", 1, asFunction)); ops.put(SpatialOps.DWITHIN, createSpatial(prefix + "DWithin", 3, asFunction)); ops.put(SpatialOps.EXTENT, createSpatial(prefix + "Extent", 1, asFunction)); ops.put(SpatialOps.COLLECT, createSpatial(prefix + "Collect", 1, asFunction)); ops.put(SpatialOps.COLLECT2, createSpatial(prefix + "Collect", 2, asFunction)); ops.put(SpatialOps.TRANSLATE, createSpatial(prefix + "Translate", 3, asFunction)); ops.put(SpatialOps.TRANSLATE2, createSpatial(prefix + "Translate", 4, asFunction)); return ops;/*from www .j av a 2s.co m*/ }
From source file:org.graylog.plugins.pipelineprocessor.functions.urls.URL.java
private static Map<String, String> splitQuery(String query) { final Map<String, String> nameValues = Maps.newHashMap(); final String[] kvPairs = query.split("&"); for (String pair : kvPairs) { try {/*from ww w. ja v a 2s . c o m*/ final int idx = pair.indexOf("="); final String key = idx > 0 ? URLDecoder.decode(pair.substring(0, idx), "UTF-8") : pair; final String value = idx > 0 && pair.length() > idx + 1 ? URLDecoder.decode(pair.substring(idx + 1), "UTF-8") : null; if (nameValues.containsKey(key)) { nameValues.put(key, nameValues.get(key) + "," + value); // TODO well, this is also crappy } else { nameValues.put(key, value); } } catch (UnsupportedEncodingException ignored) { // ignored because UTF-8 is a required encoding } } return nameValues; }
From source file:com.zaradai.kunzite.trader.orders.book.DefaultOrderBook.java
@Override protected Map<Double, PriceEntry> createEntryMap() { return Maps.newHashMap(); }
From source file:com.google.appinventor.server.properties.json.ServerJsonObject.java
@SuppressWarnings("unchecked") public ServerJsonObject(org.json.JSONObject object) { properties = Maps.newHashMap(); Iterator<String> keys = object.keys(); while (keys.hasNext()) { String key = keys.next(); try {/* w w w.j av a 2s . co m*/ properties.put(key, ServerJsonValue.convert(object.get(key))); } catch (JSONException e) { // Cannot happen! throw new AssertionError(e); } } }
From source file:com.spotify.helios.cli.Utils.java
public static <K, V> Map<K, V> allAsMap(final Map<K, ListenableFuture<V>> map) throws ExecutionException, InterruptedException { final Map<K, V> result = Maps.newHashMap(); for (final Map.Entry<K, ListenableFuture<V>> e : map.entrySet()) { result.put(e.getKey(), e.getValue().get()); }/* ww w. j av a 2s .com*/ return result; }
From source file:org.jessezhu.starriver.util.SearchFilter.java
/** * searchParamskey?OPERATOR_FIELDNAME//from w w w. j a v a 2s . co m */ public static Map<String, SearchFilter> parse(Map<String, Object> searchParams) { Map<String, SearchFilter> filters = Maps.newHashMap(); for (Map.Entry<String, Object> entry : searchParams.entrySet()) { // String key = entry.getKey(); Object value = entry.getValue(); if (StringUtils.isBlank((String) value)) { continue; } // operatorfiledAttribute String[] names = StringUtils.split(key, "_"); if (names.length != 2) { throw new IllegalArgumentException(key + " is not a valid search filter name"); } String fieldName = names[1]; Operator operator = Operator.valueOf(names[0]); // searchFilter SearchFilter filter = new SearchFilter(fieldName, operator, value); filters.put(key, filter); } return filters; }
From source file:org.apache.isis.viewer.restfulobjects.rendering.util.GraphUtil.java
private static void mergeInto(final List<String> list, final Map<PathNode, Map> map) { if (list.size() == 0) { return;//from w ww . j a v a 2s . c o m } final String str = list.get(0); final PathNode node = PathNode.parse(str); Map<PathNode, Map> submap = map.get(node); if (submap == null) { submap = Maps.newHashMap(); map.put(node, submap); } mergeInto(list.subList(1, list.size()), submap); }
From source file:com.opengamma.strata.examples.marketdata.credit.markit.MarkitYieldCurveDataParser.java
/** * Parses the specified source./*ww w.jav a 2 s . c o m*/ * * @param source the source to parse * @return the map of parsed yield curve par rates */ public static Map<IsdaYieldCurveInputsId, IsdaYieldCurveInputs> parse(CharSource source) { // parse the curve data Map<IsdaYieldCurveConvention, List<Point>> curveData = Maps.newHashMap(); CsvFile csv = CsvFile.of(source, true); for (CsvRow row : csv.rows()) { String dateText = row.getField(DATE); String tenorText = row.getField(TENOR); String instrumentText = row.getField(INSTRUMENT); String rateText = row.getField(RATE); String conventionText = row.getField(CONVENTION); Point point = new Point(Tenor.parse(tenorText), LocalDate.parse(dateText, DateTimeFormatter.ISO_LOCAL_DATE), mapUnderlyingType(instrumentText), Double.parseDouble(rateText)); IsdaYieldCurveConvention convention = IsdaYieldCurveConvention.of(conventionText); List<Point> points = curveData.get(convention); if (points == null) { points = Lists.newArrayList(); curveData.put(convention, points); } points.add(point); } // convert the curve data into the result map Map<IsdaYieldCurveInputsId, IsdaYieldCurveInputs> result = Maps.newHashMap(); for (IsdaYieldCurveConvention convention : curveData.keySet()) { List<Point> points = curveData.get(convention); result.put(IsdaYieldCurveInputsId.of(convention.getCurrency()), IsdaYieldCurveInputs.of(CurveName.of(convention.getName()), points.stream().map(s -> s.getTenor().getPeriod()).toArray(Period[]::new), points.stream().map(s -> s.getDate()).toArray(LocalDate[]::new), points.stream().map(s -> s.getInstrumentType()) .toArray(IsdaYieldCurveUnderlyingType[]::new), points.stream().mapToDouble(s -> s.getRate()).toArray(), convention)); } return result; }
From source file:com.eviware.loadui.ui.fx.views.analysis.reporting.LineChartUtils.java
public static Map<ChartView, Image> createImages(Collection<StatisticPage> pages, ObservableValue<Execution> executionProperty, Execution comparedExecution) { HashMap<ChartView, Image> images = Maps.newHashMap(); for (StatisticPage page : pages) for (ChartGroup chartGroup : page.getChildren()) images.putAll(createImages(chartGroup, executionProperty, comparedExecution)); return images; }
From source file:ru.runa.wf.logic.bot.cancelprocess.CancelProcessTaskXmlParser.java
/** * Parses DatabaseTaskHandler configuration. *//*from w w w.j a v a 2 s . co m*/ public static CancelProcessTask parse(String configuration) throws Exception { Document document = XmlUtils.parseWithXSDValidation(configuration, "cancel-process.xsd"); Element processesElement = document.getRootElement(); String processIdVariable = processesElement.attributeValue(PROCESS_ID_VARIABLE_ATTRIBUTE_NAME); List<Element> processToCancelElements = processesElement.elements(PROCESS_TO_CANCEL); Map<String, String> taskMap = Maps.newHashMap(); for (Element processEllement : processToCancelElements) { String name = processEllement.attributeValue(NAME_ATTRIBUTE_NAME); String handlerConfiguration = processEllement.attributeValue(TASK_HANDLER_CONFIGURATION_ATTRIBUT_NAME); taskMap.put(name, handlerConfiguration); } return new CancelProcessTask(processIdVariable, taskMap); }