title: How to check whether a HashMap has all the elements of an ArrayList?
body: <p>If I have a HashMap <code>hashM</code>, an ArrayList <code>arrayL</code>. If I would like to use an if statement to check whether <code>hashM</code> has all the elements in <code>arrayL</code>, how can I do that?</p>
  
  <p>I cm currently using something like </p>
  
  <p><code>if (hashM.values().containsAll(arrayL.getPreReqs()))</code> </p>
  
  <p>However it doesn't work properly.</p>
  
  <p>Dear all thanks for the answers!</p>
  
  <p>Actually containsAll works however the way I structure the my codes is wrong so that I got wrong outcomes. Now it has been fixed.</p>
  
  <p>Cheers!</p>