Example usage for com.google.common.collect Maps newHashMap

List of usage examples for com.google.common.collect Maps newHashMap

Introduction

In this page you can find the example usage for com.google.common.collect Maps newHashMap.

Prototype

public static <K, V> HashMap<K, V> newHashMap() 

Source Link

Document

Creates a mutable, empty HashMap instance.

Usage

From source file:com.orange.clara.tool.crawlers.CrawlerFactory.java

@PostConstruct
public void init() {
    crawlerMap = Maps.newHashMap();
    for (Crawler crawler : crawlers) {
        crawlerMap.put(crawler.forResourceType(), crawler);
    }

}

From source file:com.zaradai.bloodstone.properties.InMemoryParameterManager.java

protected Map<String, Object> createKeyValueMap() {
    return Maps.newHashMap();
}

From source file:com.j2swift.util.JdtParser.java

private static Map<String, String> initCompilerOptions() {
    Map<String, String> compilerOptions = Maps.newHashMap();
    String version = Options.getSourceVersion();
    compilerOptions.put(org.eclipse.jdt.core.JavaCore.COMPILER_SOURCE, version);
    compilerOptions.put(org.eclipse.jdt.core.JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, version);
    compilerOptions.put(org.eclipse.jdt.core.JavaCore.COMPILER_COMPLIANCE, version);
    return compilerOptions;
}

From source file:edu.umn.msi.tropix.galaxy.service.Contexts.java

static Context expandPathsAndBuildContext(final Tool tool, final RootInput rootInput,
        final Directory stagingDirectory) {
    GalaxyDataUtils.visitParams(tool, rootInput, new ParamVisitor() {
        public void visit(final String key, final Input fileInput, final Param param) {
            if (param.getType() == ParamType.DATA) {
                fileInput.setValue(Directories.buildAbsolutePath(stagingDirectory, fileInput.getValue()));
            }/*from  w  w w .j  a  va2  s  .c  om*/
        }
    });

    final Map<String, String> outputMap = Maps.newHashMap();
    for (final Data output : tool.getOutputs().getData()) {
        outputMap.put(output.getName(), Directories.buildAbsolutePath(stagingDirectory, output.getName()));
    }

    return new ContextBuilder().buildContext(tool, rootInput, outputMap);

}

From source file:com.amitinside.java8.practice.Fibonacci.java

public Fibonacci() {
    this.cache = Maps.newHashMap();
    this.cache.put(0, 0L);
    this.cache.put(1, 1L);
}

From source file:com.threerings.tools.gxlate.FieldMapping.java

/**
 * Converts the mapping to a column name to value map for use directly with spreadsheet
 * classes.//from   w  w  w.j  a v  a  2 s  .  co m
 */
public Map<String, String> toStringMap(Set<Language> languages) {
    Map<String, String> map = Maps.newHashMap();
    for (Map.Entry<Field, String> entry : _values.entrySet()) {
        Field field = entry.getKey();
        if (field.isLanguage()) {
            for (Language language : languages) {
                map.put(field.getColumnName(language), field.modifyValue(entry.getValue(), language));
            }
        } else {
            map.put(field.getColumnName(), entry.getValue());
        }
    }
    return map;
}

From source file:de.xaniox.heavyspleef.core.game.GameProperties.java

public GameProperties() {
    this.properties = Maps.newHashMap();

    setDefaults();
}

From source file:com.sishuok.es.maintain.push.service.PushApiImpl.java

@Override
public void pushNewNotification(final Long userId, List<Map<String, Object>> notifiations) {
    Map<String, Object> data = Maps.newHashMap();
    data.put("notifications", notifiations);
    pushService.push(userId, data);//from  w  w w. j ava2  s  .c  o  m
}

From source file:cc.recommenders.evaluation.io.ProjectFoldingStrategy.java

public Map<String, Integer> createMapping(Map<String, Integer> projectCounts, int numFolds) {
    Asserts.assertGreaterOrEqual(projectCounts.size(), numFolds);

    Set<String> projectNames = sortNamesByCount(projectCounts);

    Map<String, Integer> mapping = Maps.newHashMap();
    long[] counts = new long[numFolds];

    for (String projectName : projectNames) {
        int size = projectCounts.get(projectName);
        int idx = getSmallestIndex(counts);

        counts[idx] += size;/*w w w. jav a2  s .  com*/
        mapping.put(projectName, idx);
    }
    return mapping;
}

From source file:com.querydsl.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   w  ww  .ja va  2 s.com
}