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 isSublistOf(List<E> bigger, List<E> smaller) {
        if (smaller.size() > bigger.size())
            return false;
        for (int start = 0; start + smaller.size() <= bigger.size(); ++start) {
            List<E> sublist = bigger.subList(start, start + smaller.size());
            if (sublist.equals(bigger)) {
                return true;
            }
        }
        return false;
    }
}