title: Searching in a ArrayList with custom objects for certain strings
body: <p>I have a ArrayList with custom objects. I want to search inside this ArrayList for Strings.</p>
  
  <p>The class for the objects look like this:</p>
  
  <pre><code>public class Datapoint implements Serializable {
  
    private String stateBased;
    private String name;
    private String priority;
    private String mainNumber;
    private String groupadress;
    private String dptID;
  
    public Datapoint(){
    }
  
    public String getMainNumber() {
      return mainNumber;
    }
  
    public void setMainNumber(String mainNumber) {
      this.mainNumber = mainNumber;
    }
  
    public String getName() {
      return name;
    }
  
    ..and so on
  </code></pre>
  
  <p>I know how to search for a string in a ArrayList but how to do that in a ArrayList with my custom objects:</p>
  
  <pre><code>ArrayList&lt;String&gt; searchList = new ArrayList&lt;String&gt;();
  String search = "a";
  int searchListLength = searchList.size();
  for (int i = 0; i &lt; searchListLength; i++) {
  if (searchList.get(i).contains(search)) {
  //Do whatever you want here
  }
  }
  </code></pre>
  
  <p>So I want to have a function to search in my ArrayList with for example five objects for all "name" strings. </p>