Java tutorial
//package com.java2s; /* * Copyright (C) 2013 * * 52North Initiative for Geospatial Open Source Software GmbH * Contact: Andreas Wytzisk * Martin-Luther-King-Weg 24 * 48155 Muenster, Germany * info@52north.org * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; public class Main { public static <T> List<T> conjunctCollections(final Collection<T> list1, final Collection<T> list2) { final HashSet<T> s1 = new HashSet<T>(list1); s1.retainAll(list2); return new ArrayList<T>(s1); } }