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.druid.server.coordinator.CoordinatorStats.java

public CoordinatorStats() {
    perTierStats = Maps.newHashMap();
    globalStats = new CountingMap<String>();
}

From source file:org.apache.aurora.scheduler.storage.db.views.DbAssignedTask.java

AssignedTask toThrift() {
    Map<String, Integer> ports = Maps.newHashMap();
    for (DbAssginedPort port : assignedPorts) {
        ports.put(port.getName(), port.getPort());
    }/*ww  w  .  j a  v  a2 s .  co  m*/

    return new AssignedTask().setTaskId(taskId).setSlaveId(slaveId).setSlaveHost(slaveHost)
            .setTask(task.toThrift()).setAssignedPorts(ports).setInstanceId(instanceId);
}

From source file:org.sonar.plugins.erlang.eunit.UnitTestIndex.java

public UnitTestIndex() {
    this.indexByClassname = Maps.newHashMap();
}

From source file:io.druid.query.groupby.GroupByQueryRunnerTestHelper.java

public static Row createExpectedRow(final DateTime timestamp, Object... vals) {
    Preconditions.checkArgument(vals.length % 2 == 0);

    Map<String, Object> theVals = Maps.newHashMap();
    for (int i = 0; i < vals.length; i += 2) {
        theVals.put(vals[i].toString(), vals[i + 1]);
    }/* w  ww .  j a va  2s  . co  m*/

    DateTime ts = new DateTime(timestamp);
    return new MapBasedRow(ts, theVals);
}

From source file:org.fenixedu.learning.domain.DissertationsUtils.java

public static Map<ThesisState, String> getThesisStateMapping() {
    if (states == null) {
        states = Maps.newHashMap();
        states.put(EVALUATED, "success");
        states.put(CONFIRMED, "primary");
        states.put(DRAFT, "default");
        states.put(APPROVED, "info");
        states.put(REVISION, "warning");
        states.put(SUBMITTED, "primary");
    }/*w ww . j  av a2  s  . c  o m*/
    return states;
}

From source file:com.appdynamics.extensions.activemq.ActiveMQMetrics.java

public Map<String, String> getMetrics() {
    if (metrics == null) {
        metrics = Maps.newHashMap();
    }
    return metrics;
}

From source file:org.apache.drill.exec.store.mongo.MongoUtils.java

public static Map<String, List<BasicDBObject>> mergeFilters(Map<String, Object> minFilters,
        Map<String, Object> maxFilters) {
    Map<String, List<BasicDBObject>> filters = Maps.newHashMap();

    for (Entry<String, Object> entry : minFilters.entrySet()) {
        List<BasicDBObject> list = filters.get(entry.getKey());
        if (list == null) {
            list = Lists.newArrayList();
            filters.put(entry.getKey(), list);
        }/*from ww  w .j av a2 s .  c om*/
        list.add(new BasicDBObject(entry.getKey(), new BasicDBObject("$gte", entry.getValue())));
    }

    for (Entry<String, Object> entry : maxFilters.entrySet()) {
        List<BasicDBObject> list = filters.get(entry.getKey());
        if (list == null) {
            list = Lists.newArrayList();
            filters.put(entry.getKey(), list);
        }
        list.add(new BasicDBObject(entry.getKey(), new BasicDBObject("$lt", entry.getValue())));
    }
    return filters;
}

From source file:com.arcbees.pullrequest.PullRequestChainParser.java

public void parsePullRequestChains(PullRequests<? extends PullRequest> pullRequests) {
    Map<String, PullRequest> pullRequestsMap = Maps.newHashMap();
    for (PullRequest pullRequest : pullRequests.getPullRequests()) {
        pullRequestsMap.put(pullRequest.getSource().getBranch().getName(), pullRequest);
    }//from w  w  w. j a v  a  2 s.co m

    for (PullRequest pullRequest : pullRequestsMap.values()) {
        List<String> chain = Lists.newArrayList();

        PullRequestTarget destination = pullRequest.getDestination();
        String branchName = destination.getBranch().getName();
        chain.add(branchName);
        do {
            PullRequest destinationPullRequest = pullRequestsMap.get(branchName);
            if (destinationPullRequest != null) {
                branchName = destinationPullRequest.getDestination().getBranch().getName();
                chain.add(branchName);
            } else {
                break;
            }
        } while (pullRequestsMap.containsKey(branchName));

        pullRequest.setBranchChain(chain);
    }
}

From source file:com.spotify.helios.rollingupdate.DeploymentGroupEventFactory.java

private Map<String, Object> createEvent(final String eventType, final DeploymentGroup deploymentGroup) {
    final Map<String, Object> ev = Maps.newHashMap();
    ev.put("eventType", eventType);
    ev.put("timestamp", System.currentTimeMillis());
    ev.put("deploymentGroup", deploymentGroup);
    return ev;/*from  w  w  w  . j  av  a2  s.  co  m*/
}

From source file:org.eclipse.wb.internal.core.model.util.ScriptUtils.java

/**
 * Evaluates given script, with one variable.
 *///  w ww. j  av a 2 s. c  om
public static Object evaluate(ClassLoader contextClassLoader, String script, String name_1, Object value_1) {
    Map<String, Object> variables = Maps.newHashMap();
    variables.put(name_1, value_1);
    return evaluate(contextClassLoader, script, variables);
}