title: Overide equals method in class with aggregation Arraylist
body: <p>I need to override <code>equals()</code> and <code>hashCode()</code> methods in Java class. But this class contains a list of objects. How should I implement the part of the code with comparing <code>ArrayList</code> field?</p>
  
  <p>The code looks like:</p>
  
  <pre><code>public class FirstClass {
  
        private List&lt;SecondClass&gt; list = new ArrayList&lt;&gt;();
  
        equals() {
        //how i should implement equals for list field?
        }
  
        hashCode() {
        }
      } 
  </code></pre>
  
  <p>I can only add that <code>SecondClass</code> has well-working <code>equals</code> and <code>hashCode</code> methods.
  I know about symmetric, transition and others important things, but I only want to focus on this problem with <code>ArrayList</code> field.</p>