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:io.smartspaces.example.activity.routable.output.SimpleJavaRoutableOutputActivity.java

@Override
public void onActivityActivate() {
    Map<String, Object> message = Maps.newHashMap();
    message.put("message", "yipee! activated!");
    sendRouteMessage("output1", message);
}

From source file:io.druid.java.util.emitter.core.Emitters.java

public static Emitter create(Properties props, AsyncHttpClient httpClient, ObjectMapper jsonMapper,
        Lifecycle lifecycle) {//from www . j  a  v a2  s .c  o m
    Map<String, Object> jsonified = Maps.newHashMap();
    if (props.getProperty(LOG_EMITTER_PROP) != null) {
        jsonified = makeLoggingMap(props);
        jsonified.put("type", "logging");
    } else if (props.getProperty(HTTP_EMITTER_PROP) != null) {
        jsonified = makeHttpMap(props);
        jsonified.put("type", "http");
    } else if (props.getProperty(CUSTOM_EMITTER_TYPE_PROP) != null) {
        jsonified = makeCustomFactoryMap(props);
    } else {
        throw new ISE(
                "Unknown type of emitter. Please set [%s], [%s] or provide registered subtype of io.druid.java.util.emitter.core.factory.EmitterFactory via [%s]",
                LOG_EMITTER_PROP, HTTP_EMITTER_PROP, CUSTOM_EMITTER_TYPE_PROP);
    }
    return jsonMapper.convertValue(jsonified, EmitterFactory.class).makeEmitter(jsonMapper, httpClient,
            lifecycle);
}

From source file:org.sonar.server.issue.index.IssueAuthorizationDoc.java

public IssueAuthorizationDoc() {
    super(Maps.newHashMap());
}

From source file:de.aikiit.jmockex.LookupService.java

public Map<UUID, String> getNames(String filter) {
    final Map<UUID, String> results = Maps.newHashMap();
    if ("magic".equals(filter)) {
        results.put(UUID.fromString("f3c028fb-c9c0-4f07-8ed5-09259de0d910"), "Alfons");
        results.put(UUID.fromString("bf457d0c-b952-4f93-aaf0-5ccca62c3156"), "Zitterbacke");
    }//from   w w  w  .j  a  v  a 2  s . c om
    return results;
}

From source file:tech.beshu.ror.httpclient.RRHttpRequest.java

public static RRHttpRequest get(URI url, Map<String, String> headers) {
    return get(url, Maps.newHashMap(), headers);
}

From source file:org.ros.internal.manifest.Export.java

public Export(String name, String value) {
    this.name = name;
    this.value = value;
    attributes = Maps.newHashMap();
}

From source file:com.chingo247.structureapi.watchers.Watcher.java

public Watcher() {
    this.registered = Maps.newHashMap();
}

From source file:cuchaz.enigma.convert.ClassNamer.java

public ClassNamer(BiMap<ClassEntry, ClassEntry> mappings) {
    // convert the identity mappings to name maps
    m_sourceNames = Maps.newHashMap();
    m_destNames = Maps.newHashMap();//from   w ww.  ja  va2  s .co m
    int i = 0;
    for (Map.Entry<ClassEntry, ClassEntry> entry : mappings.entrySet()) {
        String name = String.format("M%04d", i++);
        m_sourceNames.put(entry.getKey().getName(), name);
        m_destNames.put(entry.getValue().getName(), name);
    }
}

From source file:com.kysoft.cpsi.audit.service.JsAuditServiceImpl.java

@Override
public Map<String, Object> getCompareInfo(String hcrwId, String hcsxId) {
    Map<String, Object> result = Maps.newHashMap();
    Hcsx hcsx = hcsxMapper.selectByPrimaryKey(hcsxId);
    String hcsxMc = hcsx.getName();
    Map<String, Object> param = new HashedMap();
    param.put("hcrwId", hcrwId);
    switch (hcsxMc) {
    case "?????":
        result.put("a", jsGqbgMapper.query(param));//??
        param.put("sjly", JS_GS_INFO_FLAG);
        result.put("b", jsGqbgMapper.queryBD(param));//?
        param.put("sjly", JS_GS_INFO_REAL);
        result.put("c", jsGqbgMapper.queryBD(param));//?
        break;/*from w w  w .j  a v  a  2  s  . c o  m*/
    case "??????":
        result.put("a", jsLicenseMapper.query(param));//??
        param.put("sjly", JS_GS_INFO_FLAG);
        result.put("b", jsLicenseMapper.queryBD(param));//?
        param.put("sjly", JS_GS_INFO_REAL);
        result.put("c", jsLicenseMapper.queryBD(param));//?
        break;
    case "??":
        result.put("a", jsZscqMapper.query(param));//??
        param.put("sjly", JS_GS_INFO_FLAG);
        result.put("b", jsZscqMapper.queryBD(param));//?
        param.put("sjly", JS_GS_INFO_REAL);
        result.put("c", jsZscqMapper.queryBD(param));//?
        break;
    case "?":
        result.put("a", jsXzcfMapper.query(param));//??
        param.put("sjly", JS_GS_INFO_FLAG);
        result.put("b", jsXzcfMapper.queryBD(param));//?
        param.put("sjly", JS_GS_INFO_REAL);
        result.put("c", jsXzcfMapper.queryBD(param));//?
        break;
    case "??":
        result.put("a", jsStockholderContributionMapper.query(param));//??
        param.put("sjly", JS_GS_INFO_FLAG);
        result.put("b", jsStockholderContributionMapper.queryBD(param));//?
        param.put("sjly", JS_GS_INFO_REAL);
        result.put("c", jsStockholderContributionMapper.queryBD(param));//?
        break;
    default:

    }
    return result;
}

From source file:com.palantir.atlasdb.console.AtlasConsoleBinder.java

private static AtlasConsoleModule createModule(final Object module) {
    if (module instanceof AtlasConsoleModule) {
        return (AtlasConsoleModule) module;
    }/*from w  w  w.  j  av a 2 s . co m*/

    final Map<String, String> help = Maps.newHashMap();
    final Map<String, Closure> bindings = Maps.newHashMap();
    for (Method m : module.getClass().getMethods()) {
        ConsoleBinding b = m.getAnnotation(ConsoleBinding.class);
        if (b != null) {
            Preconditions.checkArgument(!Strings.isNullOrEmpty(b.name()),
                    "@ConsoleBinding name cannot be null or empty on %s.:", m.getName());
            bindings.put(b.name(), createClosure(module, m));
            if (!Strings.isNullOrEmpty(b.help())) {
                help.put(b.name(), b.help());
            }
        }
    }
    Preconditions.checkArgument(!bindings.isEmpty(), "%s has not @ConsoleBinding annotations",
            module.getClass());
    return new AtlasConsoleModule() {
        @Override
        public Map<String, String> getHelp() {
            return help;
        }

        @Override
        public Map<String, Closure> getBindings() {
            return bindings;
        }
    };
}