title: Remove entries with conditions in a treemap
body: <p>I'm doing a Java practice, the question ask me to takes a provided TreeMap, removes entries where the key is a multiple of keyFilter and the value contains the valueFilter character, then returns the resulting TreeMap. If applying the key and value filters does not remove any entries, then
  the provided map must be returned.</p>
  <pre><code>import java.util.Iterator;
  import java.util.Map;
  import java.util.TreeMap;
  
  public class MapFilter {
      public static TreeMap&lt;Integer, String&gt; filterTreeMap(
              TreeMap&lt;Integer, String&gt; map, int keyFilter, char valueFilter) {
          
          TreeMap&lt;Integer, String&gt; finalMap = new TreeMap&lt;Integer, String&gt;();
          
          for(Map.Entry&lt;Integer, String&gt; e: finalMap.entrySet()){
              if(getKey() % keyFilter == 0 &amp;&amp; getValue().equals(valueFilter){
                  map.remove(getKey());
              }
          }
          return finalMap;
      }
  }
  </code></pre>
  <p>This is the code I have so far. I didn't get how the treemap works and also how to compare the value contains the valueFilter character. I have error on my code. Any help would be nice. Thank you!</p>