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:org.geogig.osm.internal.history.Primitive.java

public Primitive() {
    tags = Maps.newHashMap();
}

From source file:com.opengamma.web.server.push.analytics.formatting.LabelledMatrix2DFormatter.java

@Override
public Map<String, Object> formatForExpandedDisplay(LabelledMatrix2D value, ValueSpecification valueSpec) {
    Map<String, Object> results = Maps.newHashMap();
    int rowCount = value.getYKeys().length;
    int columnCount = value.getXKeys().length;
    String[] xLabels = new String[columnCount];
    String[] yLabels = new String[rowCount];
    for (int i = 0; i < xLabels.length; i++) {
        xLabels[i] = value.getXLabels()[i].toString();
    }//from   w  ww.  ja  v  a  2s.c om
    results.put("xLabels", xLabels);
    for (int i = 0; i < yLabels.length; i++) {
        yLabels[i] = value.getYLabels()[i].toString();
    }
    results.put("yLabels", yLabels);
    results.put("matrix", value.getValues());
    return results;
}

From source file:com.baidu.rigel.biplatform.ma.report.query.chart.ChartDataInputFactory.java

/**
 * ?//from   ww w .ja v a 2s  .  c  o  m
 * 
 * @param cellData
 *            ?
 * @param columnNames
 *            ??
 * @param xNodes
 *            
 * @param type
 *            ?
 * @return ?
 */
public static ChartDataInput generateTimeTrendChartInput(List<List<CellData>> cellData,
        List<String> columnNames, List<String> xNodes, AnalysisType type, XAxisType xType) {

    ChartDataInput input = new ChartDataInput();

    List<List<BigDecimal>> pureData = Lists.newArrayList();
    Map<String, DataFormat> formats = Maps.newHashMap();
    int columnSize = cellData.size();
    for (int index = 0; index < columnSize; index++) {
        List<CellData> column = cellData.get(index);
        List<BigDecimal> columnData = Lists.newArrayList();
        String formatExp = null;
        for (CellData unit : column) {
            if (formatExp == null) {
                formatExp = unit.getFormattedValue();
            }
            columnData.add(unit.getV());
        }
        String columnKey = columnNames.get(index);
        DataFormat format = DataFormat.parseByFormatExp(formatExp);
        formats.put(columnKey, format);
        pureData.add(columnData);
    }
    input.setData(pureData);
    input.setFormats(formats);
    input.setFormat("I,III.DD");
    input.setTitle("?");
    input.setType(type);
    input.setxAxis(xNodes);
    input.setyAxis(columnNames);
    input.setyAxisInfos(getDefaultYAxis(columnNames));
    input.setxAxisType(xType == null ? XAxisType.CATEGORY : xType);

    return input;
}

From source file:com.naver.timetable.dao.CategoryDAO.java

public List<String> getCatgCode(String campusCode, String majorCode) {
    Map<String, String> parameterMap = Maps.newHashMap();
    parameterMap.put("campusCode", campusCode);
    parameterMap.put("majorCode", majorCode);
    return hufsCubrid.queryForList("getCatgCode", parameterMap);
}

From source file:com.enonic.cms.core.tools.CacheInfoController.java

@Override
protected void doGet(final HttpServletRequest req, final HttpServletResponse res) throws Exception {
    final String op = req.getParameter("op");

    if ("info".equals(op)) {
        final Map<String, Object> model = Maps.newHashMap();
        model.put("baseUrl", getBaseUrl(req));
        model.put("cacheList", this.cacheManager.getAll());
        renderView(req, res, model, "cacheInfoPage_info");
    } else {//from ww  w. ja v  a2s  . c  o m
        final Map<String, Object> model = Maps.newHashMap();
        model.put("baseUrl", getBaseUrl(req));
        renderView(req, res, model, "cacheInfoPage");
    }
}

From source file:com.google.caja.ancillary.linter.ErrorReporter.java

/** Dumps error messages to the output stream. */
static MessageLevel reportErrors(Map<InputSource, CharSequence> inputs, MessageContext mc, MessageQueue mq,
        Appendable out) throws IOException {
    MessageLevel max = MessageLevel.values()[0];
    SnippetProducer sp = new SnippetProducer(inputs, mc);
    // HACK: do not commit
    Map<MessageTypeInt, Integer> counts = Maps.newHashMap();
    for (Message msg : sortMessages(mq.getMessages())) {
        counts.put(msg.getMessageType(), Integer
                .valueOf(counts.containsKey(msg.getMessageType()) ? counts.get(msg.getMessageType()) + 1 : 1));
        MessageLevel level = msg.getMessageLevel();
        if (level.compareTo(max) > 0) {
            max = level;/*from w  w w  .  j  a  v a2  s.c  om*/
        }
        String snippet = sp.getSnippet(msg);
        out.append(level.name() + " : " + msg.format(mc) + ("".equals(snippet) ? "" : "\n" + snippet) + "\n");
    }

    List<Map.Entry<MessageTypeInt, Integer>> countsInOrder = Lists.newArrayList(counts.entrySet());
    Collections.sort(countsInOrder, new Comparator<Map.Entry<MessageTypeInt, Integer>>() {
        public int compare(Map.Entry<MessageTypeInt, Integer> a, Map.Entry<MessageTypeInt, Integer> b) {
            int delta = a.getValue() - b.getValue();
            if (delta != 0) {
                return delta;
            }
            return a.getKey().name().compareTo(b.getKey().name());
        }
    });
    for (Map.Entry<MessageTypeInt, Integer> e : countsInOrder) {
        out.append(String.format("%3d %s\n", e.getValue(), e.getKey().name()));
    }
    return max;
}

From source file:com.kingen.repository.log.LogDao.java

public Page<Log> findLogs(Page<Log> page, Log vo) {

    Map<String, Object> parameter = Maps.newHashMap();

    StringBuilder hql = new StringBuilder("from Log where 1=1 "); //???
    if (vo != null && !StringUtils.isBlank(vo.getUserAgent())) {
        hql.append(" and userAgent like :p1");
        parameter.put("p1", "%" + vo.getUserAgent() + "%");
    }/*from  ww  w . j av a2s  . com*/
    if (vo != null && !StringUtils.isBlank(vo.getFromDate())) {
        hql.append(" and createDate >:p2");
        parameter.put("p2", vo.getFromDate());
    }
    if (vo != null && !StringUtils.isBlank(vo.getToDate())) {
        hql.append(" and createDate <= :p3");
        parameter.put("p3", vo.getToDate());
    }
    hql.append(" order by createDate desc");

    return find(page, hql.toString(), parameter);

}

From source file:com.appdynamics.extensions.elasticsearch.QueryMetrics.java

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

From source file:org.ow2.petals.cloud.manager.api.deployment.utils.PropertyHelper.java

/**
 *
 * @param properties//  www. j a  v a  2s. c o m
 * @return
 */
public static Map<String, String> hasMap(List<Property> properties) {
    Map<String, String> result = Maps.newHashMap();
    for (Property p : properties) {
        result.put(p.getName(), p.getValue());
    }
    return result;
}

From source file:com.liveramp.megadesk.core.state.MultiPersistenceTransaction.java

public MultiPersistenceTransaction() {
    transactions = Maps.newHashMap();
}