Java tutorial
//package com.java2s; import java.util.*; public class Main { /** * Remove duplicate values of list from map * @param values - Map of values * @param <T> - Object class * @param <K> - Key * @return - Result Map without duplcates */ public static <T, K> Map<K, List<T>> removeDuplicateValues(Map<K, List<T>> values) { if (values == null) { return values; } Map<K, List<T>> newValues = new LinkedHashMap<K, List<T>>(); for (K key : values.keySet()) { newValues.put(key, removeDuplicateValues(values.get(key))); } return newValues; } /** * Remove duplicate values of list from list * @param values - List of values to filter * @param <T> - Object class * @return - Filtered list */ public static <T> List<T> removeDuplicateValues(List<T> values) { if (values == null) { return values; } return new ArrayList(new HashSet<T>(values)); } }