title: Count the occurrences of items in ArrayList
body: <p>I have a <code>java.util.ArrayList&lt;Item&gt;</code> and an <code>Item</code> object.</p>
  
  <p>Now, I want to obtain the number of times the <code>Item</code> is stored in the arraylist.</p>
  
  <p>I know that I can do <code>arrayList.contains()</code> check but it returns true, irrespective of whether it contains one or more <code>Item</code>s. </p>
  
  <p>Q1. How can I find the number of time the Item is stored in the list?</p>
  
  <p>Q2. Also, If the list contains more than one Item, then how can I determine the index of other Items because <code>arrayList.indexOf(item)</code> returns the index of only first Item every time?</p>