title: java - ArrayList contains another ArrayList of self-defined object type
body: <p>I am new to Java and search for method to check if an ArrayList contains another ArrayList of self-defined object type, and the order relation must keep the same.</p>
  
  <p>For example:</p>
  
  <pre><code>public class IntervalPoint implements Comparable&lt;IntervalPoint&gt;{
      private String label;
      private boolean startend;
  }
  
  ArrayList&lt;IntervalPoint&gt; a1;
  ArrayList&lt;IntervalPoint&gt; a2;
  ArrayList&lt;IntervalPoint&gt; a3;
  ArrayList&lt;IntervalPoint&gt; a4;
  
  a1 has elements: (a,1) (b,1) (a,0) (b,0)
  a2 has elements: (a,1) (b,1) (c,1) (a,0) (c,0) (b,0)
  a3 has elements: (a,1) (b,1) (b,0) (a,0)
  a3 has elements: (a,1) (c,1) (a,0) (c,0)
  
  a2.contains(a1) returns true
  a3.contains(a1) returns false, since the order relationshops are changed
  a3.contains(a1) returns false, since the element is different
  </code></pre>
  
  <p>I've checked containsAll() function but it seems not the correct one for this application.
  My idea is to override a sequentially scanning methods, which examine if an element in a1 is contained in ax; if the target is found, restart scanning from that position afterward to find the next element in a1.
  But this would be quiet time consuming...</p>