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 Collection and(Collection collection1, Collection collection2) {
        Vector completeList = new Vector();

        if (collection2 == null)
            return completeList;
        Iterator i = collection2.iterator();
        while (i.hasNext()) {
            Object addlItem = i.next();
            if (collection1.contains(addlItem) == true) {
                completeList.addElement(addlItem);
            }
        }
        return completeList;
    }
}