Effecient way of updating a Map from a List
<p>Given I have a <code>LinkedHashMap&lt;String,Boolean&gt;</code> and an <code>ArrayList&lt;String&gt;</code>, how do I update <code>LinkedHashMap</code> based on keys?</p>

<p>The solution I can think of is:</p>

<pre><code>private void updateFilesPath(LinkedHashMap&lt;String,Boolean) map,ArrayList&lt;String&gt; list) {
    for (String filePath : list)
        if (map.get(filePath) == null)
            map.put(filePath, true);
}
</code></pre>

<p>But This soloution is <code>O(n^2)</code> (n times iterating and searching in the collection with time complexity <code>O(n)</code>)<br>
Is there a more efficient way of achieving this?</p>