title: sort a map from its keys ordered by values from another list
body: <p>I have a Map with key String and values String and a list of Strings. i want to sort the Map with keys based on the order of values present in the list.</p>
  
  <pre><code>package da.fa;
  
  
  public class MapSorted {
  
  public static void main(String[] args) {
  
      List&lt;String&gt; efgh = new ArrayList&lt;String&gt;();
      efgh.add("ccc");
      efgh.add("aaa");
      efgh.add("ddd");
      efgh.add("aaa");
  
      Map&lt;String, String&gt; abcd = new HashMap&lt;String, String&gt;();
      abcd.put("aaa", "1111");
      abcd.put("bbb", "1111");
      abcd.put("ccc", "1111");
      abcd.put("ddd", "1111");
      abcd.put("eee", "1111");
  }
  }
  </code></pre>
  
  <p>in this, abcd should be sorted by the order of what values are in the list efgh has.</p>