Java Map Create buildMap(List a, Map coeffs)

Here you can find the source of buildMap(List a, Map coeffs)

Description

build Map

License

Open Source License

Declaration

private static <T> void buildMap(List<? extends T> a, Map<T, Integer> coeffs) 

Method Source Code

//package com.java2s;
/* License as published by the Free Software Foundation; either         */

import java.util.List;
import java.util.Map;

public class Main {
    private static <T> void buildMap(List<? extends T> a, Map<T, Integer> coeffs) {
        for (T t : a) {
            Integer coeff = coeffs.get(t);
            if (coeff == null) {
                coeffs.put(t, 1);/*from   w ww.j  a  v  a 2s.co m*/
            } else {
                coeffs.put(t, coeff + 1);
            }
        }
    }
}

Related

  1. buildMap(K key, V value)
  2. buildMap(K key1, V value1)
  3. buildMap(Object key, Object value)
  4. buildMap(Object... data)
  5. buildMap(String... keysAndValues)
  6. buildMap(String... keyValuePairs)