title: Finding index of duplicate values in an ArrayList
body: <p>I have an ArrayList which contains duplicate values at diff diff index.
  for example <code>{"Indian","American","Chinese","Australian","Indian","Russian","Indian"}</code>
  as u can see the value - <code>"Indian"</code> exists at index - <code>0</code>, <code>4</code> &amp; <code>6</code>.</p>
  
  <p>I need to know all these indexes where <code>"Indian"</code> exists and create an arrayList of that.
  Here is my code:</p>
  
  <pre><code>public void filter(){
  
  
      categoryArray = Arrays.asList(category);
  
      for(String k : category){
          //Log.v("filter", filterTerm);
          if(k.equals(filterTerm.toLowerCase()))
          {               
              int p = categoryArray.indexOf(k);                   
              Log.v("index of categArr", ""+p);
              String id = Integer.toString(p);
              indexes.add(id);
  
  
          }// end of if
      }// end of for
  </code></pre>
  
  <p>Here I get how many times duplicate occurs by getting the size of indexes(ArrayList)
  but when I check the values . Its one value at all index since in the method : <code>indexOf()</code> it always brings the index of first value that it finds in the Array.</p>
  
  <p>So if duplicate exists at index - <code>2</code>,<code>5</code>,<code>7</code>
  I get the array size of index as <code>3</code>.
  But the values are <code>{2,2,2,};</code></p>