Java tutorial
//package com.java2s; import java.util.List; public class Main { public static <E> boolean containsSequence(List<E> list, List<E> sequence) { for (int i = 0; i < list.size() && i + sequence.size() <= list.size(); i++) { List<E> sublist = list.subList(i, i + sequence.size()); if (sublist.equals(sequence)) { return true; } } return false; } }