title: How to filter a List which is a value of a Map entry in java 8?
body: <p>I have a <code>Map&lt;B, List&lt;A&gt;&gt;</code>. I want to filter out some A based on some predicate which relies on the key of the map entry of type B. For example here is my data structure:</p>
  
  <pre><code>List&lt;Integer&gt; list1 = Arrays.asList(5,2,3,4);
  List&lt;Integer&gt; list2 = Arrays.asList(5,6,7,8);
  List&lt;Integer&gt; list3 = Arrays.asList(9,10,11,12,13);
  List&lt;Integer&gt; list4 = Arrays.asList(11,23,112);
  Map&lt;Long, List&lt;Integer&gt;&gt; map = new HashMap&lt;&gt;();
  map.putIfAbsent(2L, list1);
  map.putIfAbsent(3L, list2);
  map.putIfAbsent(4L, list3);
  map.putIfAbsent(5L, list4);
  </code></pre>
  
  <p>Now I want to iterate through the entrySet of the map and make a new map having list  containing the elements which is a multiple of the key of that entry. i.e. The output should look like this:</p>
  
  <pre><code>2L --&gt; List of (2, 4)
  3L --&gt; List of (6)
  4L --&gt; List of (12)
  5L --&gt; empty List
  </code></pre>
  
  <p>The filtering predicate uses the map entry key value to test the list elements. How can I achieve this without modifying the original map ?</p>