Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Map; public class Main { /** * Returns a map of all values in <b>a</b> who's value is not a * key in <b>b</b>. * * @param a The source map of key value pairs used to populate * the resulting map. * * @param b The exclusion map, who's keys are the exclusions * matching map <b>a</b>'s values. * * @return a map of all values in <b>a</b> who's value is not a * key in <b>b</b>. */ public static <K, V> Map<K, V> outerJoin(Map<K, V> a, Map<V, ?> b) { Map<K, V> buffer = new HashMap<K, V>(); for (Map.Entry<K, V> entry : a.entrySet()) { if (!b.containsKey(entry.getValue())) { buffer.put(entry.getKey(), entry.getValue()); } } return buffer; } }