Java List Copy copyList(List objects)

Here you can find the source of copyList(List objects)

Description

Copies a List into a new List.

License

Open Source License

Parameter

Parameter Description
objects a parameter

Declaration

public static List copyList(List objects) 

Method Source Code

//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;
    }
}

Related

  1. copyInto(List source, List dest)
  2. copyList(Collection c)
  3. copyList(Collection list)
  4. copyList(final List source, final List destination)
  5. copyList(final List list)
  6. copyList(List source, List destination)
  7. copyList(List src)
  8. copyList(List list)
  9. copyList(List list)