title: find index of an customized object in arraylist (android)
body: <p>I have created a model  </p>
  
  <pre><code> public class Portfolio {
  
      private String id;
      private String name;
  
      public Portfolio() {
  
      }
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  }
  </code></pre>
  
  <p>i have a list of this model. i want to find a position of an specific item in it.<br>
  I have tried   </p>
  
  <pre><code>Portfolio p = new Portfolio();
  p.setId("1");
  p.setName("Test");
  int i = PortfolioList.indexOf(p);
  </code></pre>
  
  <p>when i log the value of "<strong>i</strong>" it returns "<strong>-1</strong>". but i m sure the "<strong>p</strong>" object is available in arraylist.<br>
  i dont want to use <strong>for()</strong> loop. i think it takes time to find an object, if there is so many objects in our arraylist.</p>
  
  <p>what is the currect way of using <strong>indexOf()</strong> method?</p>