title: Performance benefits of using a List vs Map in Java
body: <p>I have been wondering what is the actual benefit of using Lists. Please note that my question is not "when to use what" but rather Is there any impact on performance if i insist on having maps as my primary objects </p>
  
  <p>obviously if my aim is to just work on values</p>
  
  <blockquote>
    <p>UPDATE after not being clear with my intent at first glance: I meant
    if i just want to filter a list of [8000] people whose age is > 30 , i
    would use a list... But can i use a map instead and have it be used
    instead - My Question is -  will there be any performance hindrance ?</p>
  </blockquote>
  
  <p>I would also use List. But do we get any performance boost - if yes - How can I see it myself.</p>
  
  <p>for example if i take </p>
  
  <pre><code>List &lt;Integer&gt; listOfInt = new ArrayList&lt;&gt;(map.values());
  </code></pre>
  
  <p>It would make sense to use Map as my global object and serve lists based on it. </p>
  
  <p>I know the key/value O(1) runtime for insert or remove in Maps but then why Lists are preferred most places i have seen.</p>