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.cloudera.kitten.util.Extras.java

public Extras() {
    this.env = Maps.newHashMap();
    this.resources = Maps.newHashMap();
}

From source file:org.obiba.rserver.Resources.java

public static Map<String, String> getRservConf() {
    if (conf != null)
        return conf;

    conf = Maps.newHashMap();

    try (BufferedReader br = new BufferedReader(new FileReader(getRservConfFile()))) {
        putEntries(br, conf);//from ww  w.java 2  s  . c  o m
    } catch (IOException e) {
        log.error("Failed reading Rserv.conf file", e);
    }

    return conf;
}

From source file:org.glowroot.common.util.Masking.java

public static Map<String, String> maskSystemProperties(Map<String, String> systemProperties,
        List<String> maskSystemProperties) {
    if (maskSystemProperties.isEmpty()) {
        return systemProperties;
    }//from  w ww  .  j av a2  s.c om
    List<Pattern> maskPatterns = buildPatternList(maskSystemProperties);
    Map<String, String> maskedSystemProperties = Maps.newHashMap();
    for (Map.Entry<String, String> entry : systemProperties.entrySet()) {
        String name = entry.getKey();
        if (matchesAny(name, maskPatterns)) {
            maskedSystemProperties.put(name, MASKED_VALUE);
        } else {
            maskedSystemProperties.put(name, entry.getValue());
        }
    }
    return maskedSystemProperties;
}

From source file:net.diogobohm.timed.api.db.serializer.DBTaskSerializer.java

@Override
public Map<String, Object> serialize(DBTask object) {
    Map<String, Object> valueMap = Maps.newHashMap();

    valueMap.put("activity_id", object.getActivityId());
    valueMap.put("project_id", object.getProjectId());
    valueMap.put("start_time", object.getStartDateTime());
    valueMap.put("end_time", object.getFinishDateTime());
    valueMap.put("description", object.getDescription());

    return valueMap;
}

From source file:org.s1ck.gdl.model.Element.java

public Element() {
    properties = Maps.newHashMap();
}

From source file:com.collective.celos.ci.Utils.java

public static Map<JsonElement, Integer> fillMapWithJsonFromIS(InputStream content) throws IOException {
    Map<JsonElement, Integer> jsonElems = Maps.newHashMap();
    BufferedReader reader = new BufferedReader(new InputStreamReader(content));
    String line;//from  w  w w . ja v a 2  s .co m
    while ((line = reader.readLine()) != null) {
        JsonElement entity = jsonParser.parse(line);
        Integer cnt = jsonElems.get(entity);
        jsonElems.put(entity, cnt == null ? 1 : cnt + 1);
    }
    return jsonElems;
}

From source file:keywhiz.AuthHelper.java

/**
 * Builds a Keywhiz login request./*from www  . java2  s .  c  om*/
 *
 * @param username login username
 * @param password login password
 * @return valid login request, given a valid username and password
 */
public static Request buildLoginPost(@Nullable String username, @Nullable String password) {
    Map<String, String> login = Maps.newHashMap();
    if (username != null) {
        login.put("username", username);
    }

    if (password != null) {
        login.put("password", password);
    }

    RequestBody body;
    try {
        body = RequestBody.create(KeywhizClient.JSON, MAPPER.writeValueAsString(login));
    } catch (JsonProcessingException e) {
        throw new AssertionError(e);
    }

    return new Request.Builder().url(HttpClients.testUrl("/admin/login")).post(body)
            .addHeader("Content-Type", MediaType.APPLICATION_JSON).build();
}

From source file:org.apache.stanbol.client.enhancer.model.EnhancementParser.java

/**
 * Parse a Jena model as a list of enhancements
 * /*from w w  w. j a  va 2s . com*/
 * @param model Jena model
 * @return List of enhancements
 */
static Collection<Enhancement> parse(Model model) {
    Map<String, Enhancement> enhancements = Maps.newHashMap();

    final ResIterator enhancementsIterator = model.listSubjectsWithProperty(RDF.type,
            EnhancementStructureOntology.ENHANCEMENT);
    while (enhancementsIterator.hasNext()) {
        final Resource enhancementResource = enhancementsIterator.next();
        final Enhancement enhancement = parse(enhancementResource);

        if (enhancement != null) {
            enhancements.put(enhancementResource.getURI(), enhancement);
        }
    }

    processRelations(enhancements);
    return enhancements.values();
}

From source file:nextmethod.collections.MapBuilder.java

private MapBuilder() {
    this.map = Maps.newHashMap();
}

From source file:de.matzefratze123.heavyspleef.core.hook.HookManager.java

public HookManager() {
    this.hooks = Maps.newHashMap();
}