Example usage for org.apache.commons.collections MapUtils getLong

List of usage examples for org.apache.commons.collections MapUtils getLong

Introduction

In this page you can find the example usage for org.apache.commons.collections MapUtils getLong.

Prototype

public static Long getLong(Map map, Object key, Long defaultValue) 

Source Link

Document

Looks up the given key in the given map, converting the result into a long, using the default value if the the conversion fails.

Usage

From source file:com.produban.openbus.processor.util.CountByDate.java

public Map<String, Long> combine(Map<String, Long> val1, Map<String, Long> val2) {
    for (Map.Entry<String, Long> entry : val2.entrySet()) {
        val2.put(entry.getKey(), MapUtils.getLong(val1, entry.getKey(), 0L) + entry.getValue());
    }/*from   ww w.j a v a2s.co  m*/
    for (Map.Entry<String, Long> entry : val1.entrySet()) {
        if (val2.containsKey(entry.getKey())) {
            continue;
        }
        val2.put(entry.getKey(), entry.getValue());
    }
    return val2;
}