Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;

public class Main {

    public static <T> boolean isSubset(List<T> subList, List<T> list) {
        if (subList == null || list == null || subList.isEmpty() || list.isEmpty()) {
            return false;
        }
        List<T> subList1 = new ArrayList();
        subList1.addAll(subList);

        for (T t : list) {
            if (subList1.contains(t)) {
                subList1.remove(t);
            }
        }
        if (subList1.isEmpty()) {
            return true;
        }
        return false;
    }
}