Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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;
    }
}