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.eincs.decanter.utils.collection.MapWrapper.java

public MapWrapper() {
    this.delegate = Maps.newHashMap();
}

From source file:com.github.explainable.benchmark.preparedstmt.ExecSubstitutionMap.java

public static ExecSubstitutionMap create(List<Term> arguments) {
    Map<Term, Term> substitutions = Maps.newHashMap();
    for (int i = 0; i < arguments.size(); i++) {
        substitutions.put(Terms.constant("$" + (i + 1)), arguments.get(i));
    }//from ww  w . j av  a 2  s .  c om
    return new ExecSubstitutionMap(substitutions);
}

From source file:org.vclipse.vcml.formatting.OptionsProvider.java

public OptionsProvider() {
    options = Maps.newHashMap();
}

From source file:com.opengamma.web.analytics.formatting.SurfaceFormatterUtils.java

static Object formatExpanded(Surface<Double, Double, Double> surface) {
    if (surface instanceof InterpolatedDoublesSurface) {
        List<Double> vol = Lists.newArrayList();
        // the x and y values won't necessarily be unique and won't necessarily map to a rectangular grid
        // this projects them onto a grid with values at every point
        Set<Double> xData = Sets.newTreeSet(Arrays.asList(surface.getXData()));
        Set<Double> yData = Sets.newTreeSet(Arrays.asList(surface.getYData()));
        for (Double y : yData) {
            for (Double x : xData) {
                vol.add(surface.getZValue(x, y));
            }//from ww w.  j  a  v  a  2 s . c  o  m
        }
        Map<String, Object> results = Maps.newHashMap();
        results.put(X_VALUES, xData);
        results.put(X_LABELS, SurfaceFormatterUtils.getAxisLabels(xData));
        results.put(X_TITLE, ""); // TODO use labels from VolatilitySurface once they exist
        results.put(Y_VALUES, yData);
        results.put(Y_LABELS, SurfaceFormatterUtils.getAxisLabels(yData));
        results.put(Y_TITLE, ""); // TODO use labels from VolatilitySurface once they exist
        results.put(VOL, vol);
        return results;
    } else if (surface instanceof ConstantDoublesSurface) {
        Map<String, Object> results = Maps.newHashMap();
        results.put(LabelledMatrix2DFormatter.X_LABELS, Collections.singletonList("All"));
        results.put(LabelledMatrix2DFormatter.Y_LABELS, Collections.singletonList("All"));
        results.put(LabelledMatrix2DFormatter.MATRIX, Collections.singletonList(surface.getZData()));
        return results;
    } else {
        // TODO format as matrix
        // TODO this won't work - the cell value isn't an error so this makes no difference
        return new MissingValueFormatter(
                "Unable to format surface of type " + surface.getClass().getSimpleName());
    }
}

From source file:com.joey.Fujikom.modules.sys.utils.DictUtils.java

public static List<Dict> getDictList(String type) {
    @SuppressWarnings("unchecked")
    Map<String, List<Dict>> dictMap = (Map<String, List<Dict>>) CacheUtils.get(CACHE_DICT_MAP);
    if (dictMap == null) {
        dictMap = Maps.newHashMap();
        for (Dict dict : dictDao.findAllList()) {
            List<Dict> dictList = dictMap.get(dict.getType());
            if (dictList != null) {
                dictList.add(dict);/*w w w.ja  v  a 2  s .  c  o m*/
            } else {
                dictMap.put(dict.getType(), Lists.newArrayList(dict));
            }
        }
        CacheUtils.put(CACHE_DICT_MAP, dictMap);
    }

    List<Dict> dictList = dictMap.get(type);
    if (dictList == null) {
        dictList = Lists.newArrayList();
    }
    return dictList;
}

From source file:com.ebay.xcelite.column.ColumnsMapper.java

public ColumnsMapper(Set<Col> columns) {
    columnsMap = Maps.newHashMap();
    for (Col col : columns) {
        columnsMap.put(col.getName(), col);
    }
}

From source file:com.janeluo.jfinalplus.kit.ModelKit.java

@SuppressWarnings({ "rawtypes", "unchecked" })
public static Map<String, Object> toMap(Model model) {
    Map<String, Object> map = Maps.newHashMap();
    Set<Entry<String, Object>> attrs = model._getAttrsEntrySet();
    for (Entry<String, Object> entry : attrs) {
        map.put(entry.getKey(), entry.getValue());
    }/*www. ja v a 2 s  . c om*/
    return map;
}

From source file:com.aistor.modules.sys.utils.DictUtils.java

public static List<Dict> getDictList(String type) {
    @SuppressWarnings("unchecked")
    Map<String, List<Dict>> dictMap = (Map<String, List<Dict>>) CacheUtils.get("dictMap");
    if (dictMap == null) {
        dictMap = Maps.newHashMap();
        for (Dict dict : dictDao.findAllList()) {
            List<Dict> dictList = dictMap.get(dict.getType());
            if (dictList != null) {
                dictList.add(dict);/* ww  w. java2s. com*/
            } else {
                dictMap.put(dict.getType(), Lists.newArrayList(dict));
            }
        }
        CacheUtils.put("dictMap", dictMap);
    }
    List<Dict> dictList = Lists.newArrayList();
    if (dictList != null) {
        dictList = dictMap.get(type);
    }
    return dictList;
}

From source file:org.auraframework.throwable.quickfix.CreateThemeAttributeQuickFix.java

private static Map<String, Object> createMap(DefDescriptor<?> descriptor, String name) {
    Map<String, Object> ret = Maps.newHashMap();
    ret.put("descriptor", descriptor);
    ret.put("name", name);
    return ret;// www  .  j a va 2 s.  c o  m
}

From source file:oims.support.util.ProductPlanDataTable.java

public ProductPlanDataTable(String serilizedInfo) {
    serilizedInfo_ = serilizedInfo;
    productNameToId_ = Maps.newHashMap();
    productList_ = Maps.newHashMap();
    unserializeInfo(serilizedInfo_);
}