title: Java ArrayList, how to ignore a value from the object when using contains()
body: <p>I have a class like that:</p>
  
  <pre><code>public class Student implements Serializable{
    private String name;
    private int age;
    private Image img;
  }
  </code></pre>
  
  <p>I store a few students in an ArrayList and write them to a file. When I restart the application I load them from that file again. However, the <code>Image img</code> variable is constantly changing. That means when I use <code>arrayList.contains(studentA)</code> it's not the same object anymore, so <code>arrayList.remove(studentA)</code> won't work.</p>
  
  <p>Is there an easy way to either: Only check for the name of the student or ignore the <code>Image</code> field when using <code>contains()</code>?</p>