Here you can find the source of copyList(List objects)
Parameter | Description |
---|---|
objects | a parameter |
public static List copyList(List objects)
//package com.java2s; /******************************************************************************* * Copyright (c) 2008 Conselleria de Infraestructuras y Transporte, Generalitat * de la Comunitat Valenciana . 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 * //ww w. j a v a 2 s. c o m * Contributors: Francisco Javier Cano Mu?oz (Prodevelop) ? Initial implementation. * Marc Gil Sendra (Prodevelop) - select the diagramEditPart from a View * ******************************************************************************/ import java.util.ArrayList; import java.util.List; public class Main { /** * Copies a {@link List} into a new List. * * @param objects * @return */ public static List copyList(List objects) { if (objects == null) { return null; } List newList = new ArrayList(objects.size()); for (Object o : objects) { newList.add(o); } return newList; } }