title: Sorting LinkedHashMap by key java
body: <p>So I'm a newbie and I am struggling a lot with maps. So I have a map and I want to order it by keys in ascending order. But I can't seem to find any solution to that. Thanks for the help!</p>
  
  <pre><code> LinkedHashMap&lt;String, String&gt; resulting= new LinkedHashMap&lt;&gt;();
   resulting=resulting.entrySet().stream().sorted((a,b)-&gt;{
          String first=a.getKey();
          String second=b.getKey();
          return first.compareTo(second)
      });
  </code></pre>