Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {

    public static <T> int getFreq(ArrayList<ArrayList<T>> a, ArrayList<T> b) {
        int res = 0;
        for (int i = 0; i < a.size(); i++) {
            if (isContain(a.get(i), b)) {
                res++;
            }
        }
        return res;
    }

    public static <T> boolean isContain(ArrayList<T> a, ArrayList<T> b) {
        boolean res = false;
        for (int i = 0; i < b.size(); i++) {
            if (!a.contains(b.get(i))) {
                break;
            }
            if (i == b.size() - 1) {
                res = true;
            }
        }
        return res;
    }
}