Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.Iterator;
import java.util.List;

public class Main {
    public static <T> List<T> intersection(Collection<T> a, Collection<T> b) {
        ArrayList list = new ArrayList();
        Iterator i$ = a.iterator();

        while (i$.hasNext()) {
            Object element = i$.next();
            if (b.contains(element)) {
                list.add(element);
            }
        }

        return list;
    }
}