Java List Copy copyList(final List source, final List destination)

Here you can find the source of copyList(final List source, final List destination)

Description

Copy the contents of the source list to the destination list Any items in the destination list before the copy will be removed

License

Open Source License

Parameter

Parameter Description
source a parameter
destination a parameter

Declaration

public static synchronized void copyList(final List source, final List destination) 

Method Source Code


//package com.java2s;
import java.util.List;

public class Main {
    /**/*from   w ww.  jav  a  2 s . c  om*/
     * Copy the contents of the source list to the destination list
     * Any items in the destination list before the copy will be removed
     * @param source
     * @param destination
     */
    public static synchronized void copyList(final List source, final List destination) {
        if (source != null && destination != null) {
            destination.clear();
            for (Object obj : source) {
                destination.add(obj);
            }
        }
    }
}

Related

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