@Test public void testAddValue() { Map<Integer, Integer> map = new HashMap<>(16); assertTrue(MapUtils.addValue(map, 1, 0) == 0); assertTrue(MapUtils.addValue(map, 1, 1) == 1); assertTrue(MapUtils.addValue(map, 1, 1) == 2); assertTrue(MapUtils.addValue(map, 1, 0) == 2); }
public static <K> Integer addValue(Map<K, Integer> source, K key, int value) { return source.compute(key, (k, v) -> v == null ? value : value + v); }
MapUtils { public static <K> Integer addValue(Map<K, Integer> source, K key, int value) { return source.compute(key, (k, v) -> v == null ? value : value + v); } }
MapUtils { public static <K> Integer addValue(Map<K, Integer> source, K key, int value) { return source.compute(key, (k, v) -> v == null ? value : value + v); }  }
MapUtils { public static <K> Integer addValue(Map<K, Integer> source, K key, int value) { return source.compute(key, (k, v) -> v == null ? value : value + v); }  static boolean isEmpty(final Map<?, ?> map); static boolean isNotEmpty(final Map<?, ?> map); static HashMap<K, V> of(K key, V value); static V getOrMaxKey(final Map<Integer, V> map, Integer key); @Deprecated static void add(Map<K, Integer> source, Map<K, Integer> value); static void addByIntValue(Map<K, Integer> source, Map<K, Integer> value); static void addByLongValue(Map<K, Long> source, Map<K, Long> value); static Integer addValue(Map<K, Integer> source, K key, int value); static Long addValue(Map<K, Long> source, K key, long value); static Float addValue(Map<K, Float> source, K key, float value); static Double addValue(Map<K, Double> source, K key, double value); @SafeVarargs static double getRatioValue(Map<K, Long> map, double ratio, K... keys); @SafeVarargs static double getPermillageValue(Map<K, Long> map, K... keys); @SafeVarargs static double getPercentageValue(Map<K, Long> map, K... keys); }
MapUtils { public static <K> Integer addValue(Map<K, Integer> source, K key, int value) { return source.compute(key, (k, v) -> v == null ? value : value + v); }  static boolean isEmpty(final Map<?, ?> map); static boolean isNotEmpty(final Map<?, ?> map); static HashMap<K, V> of(K key, V value); static V getOrMaxKey(final Map<Integer, V> map, Integer key); @Deprecated static void add(Map<K, Integer> source, Map<K, Integer> value); static void addByIntValue(Map<K, Integer> source, Map<K, Integer> value); static void addByLongValue(Map<K, Long> source, Map<K, Long> value); static Integer addValue(Map<K, Integer> source, K key, int value); static Long addValue(Map<K, Long> source, K key, long value); static Float addValue(Map<K, Float> source, K key, float value); static Double addValue(Map<K, Double> source, K key, double value); @SafeVarargs static double getRatioValue(Map<K, Long> map, double ratio, K... keys); @SafeVarargs static double getPermillageValue(Map<K, Long> map, K... keys); @SafeVarargs static double getPercentageValue(Map<K, Long> map, K... keys);  }