/*******************************************************************************
* Copyright (c) 2010 SAP AG.
* 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
*
* Contributors:
* Emil Simeonov - initial API and implementation.
* Dimitar Donchev - initial API and implementation.
* Dimitar Tenev - initial API and implementation.
* Nevena Manova - initial API and implementation.
* Georgi Konstantinov - initial API and implementation.
* Jakob Spies - initial API and implementation.
*******************************************************************************/
//package com.nowjava;
/**
n o w j a v a . c o m - 时 代 Java 提供
**/
import java.util.ArrayList;
import java.util.Collection;
public class Main {
public static void main(String[] argv) {
Collection source = java.util.Arrays.asList("asdf", "nowjava.com");
System.out.println(duplicate(source));
}
/**
* Returns a new {@link ArrayList} with the same contents as <code>source</code>,
* except for the case that <code>source</code> is nil or empty, in which <code>source</code>
* itself is returned.
* @param <T> element type
* @param source the {@link Collection} to clone
* @return a new {@link ArrayList} with the same contents as <code>source</code>,
* except for the case that <code>source</code> is nil or empty, in which <code>source</code>
* itself is returned
*/
public static <T> Collection<T> duplicate(Collection<T> source) {
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。