Java Collection Subtract subMap(Map map, Collection keys)

Here you can find the source of subMap(Map map, Collection keys)

Description

sub Map

License

Open Source License

Declaration

public static <K, V> Map<K, V> subMap(Map<K, V> map, Collection<K> keys) 

Method Source Code


//package com.java2s;

import java.util.*;

public class Main {

    public static <K, V> Map<K, V> subMap(Map<K, V> map, Collection<K> keys) {
        Map<K, V> subMap = new HashMap<K, V>(keys.size());
        for (K key : keys) {
            V value = map.get(key);/*from   w w w.j  a  v a  2  s. c o m*/
            if (value != null) {
                subMap.put(key, value);
            }
        }
        return subMap;
    }
}

Related

  1. sub(Collection s, T item)
  2. subCollection(Collection col, int amount)
  3. subCollection(final Collection collection, final int offset, final int limit)
  4. substractBackground( final Map> concentrationToSampleReadings, final Map> concentrationToBackgroundReadings)
  5. subtract(Collection a, Collection b)
  6. subtract(Collection c1, Collection c2)
  7. subtract(Collection a, Collection b)