Java List Null Empty fillEmptyEntries(Iterable keys, Map> map)

Here you can find the source of fillEmptyEntries(Iterable keys, Map> map)

Description

Adds a references to the empty list for keys to the map that are currently not yet contained in this map.

License

Open Source License

Declaration

public static <T> void fillEmptyEntries(Iterable<? extends Long> keys, Map<Long, List<T>> map) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    /**/*from   ww w .j a  v  a 2 s  . com*/
     * Adds a references to the empty list for keys to the map that are
     * currently not yet contained in this map.
     */
    public static <T> void fillEmptyEntries(Iterable<? extends Long> keys, Map<Long, List<T>> map) {
        for (Long processId : keys) {
            if (!map.containsKey(processId)) {
                List<T> empty = Collections.emptyList();
                map.put(processId, empty);
            }
        }
    }
}

Related

  1. emptyStringList()
  2. emptyToNull(List list)
  3. emptyToNull(List list)
  4. equalsEmptyEqNull(List list1, List list2)
  5. equalsNullSafe(List list1, List list2)
  6. fillNull(final List list, final int numElements)
  7. fillNull(List lst, int size)
  8. fillUpWithNulls(List list)
  9. getEmptyList(Class cls)