public static <T> boolean isSubList(List<T> l1, List<? super T> l) {
    Iterator<? super T> it = l.iterator();
    Iterator<T> it1 = l1.iterator();
    while (it1.hasNext()) {
      Object o1 = it1.next();
      if (!it.hasNext())
        return false;
      Object o = it.next();
      while ((o == null && !(o1 == null)) || (o != null && !o.equals(o1))) {
        if (!it.hasNext())
          return false;
        o = it.next();
      }
    }
    return true;
  }
public static < T > boolean isSubList ( List < T > l1 , List < ? super T > l ) { Iterator < ? super T > it = l . iterator ( ) ; Iterator < T > it1 = l1 . iterator ( ) ; while ( it1 . hasNext ( ) ) { Object o1 = it1 . next ( ) ; if ( ! it . hasNext ( ) ) return false ; Object o = it . next ( ) ; while ( ( o == null && ! ( o1 == null ) ) || ( o != null && ! o . equals ( o1 ) ) ) { if ( ! it . hasNext ( ) ) return false ; o = it . next ( ) ; } } return true ; }
Returns true iff l1 is a sublist of l (i.e., every member of l1 is in l,
and for every e1 < e2 in l1, there is an e1 < e2 occurrence in l).