Java examples for java.util:Collection Sub Collection
Get sub Map from key collection
//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);// w w w .ja v a 2 s . c o m if (value != null) { subMap.put(key, value); } } return subMap; } }