Java List Copy copyOf(List list)

Here you can find the source of copyOf(List list)

Description

Returns a copy of the given list.

License

Open Source License

Parameter

Parameter Description
T Type of list elements
list List to copy

Return

Copy of list containing the same elements

Declaration

public static <T> List<T> copyOf(List<T> list) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**/*from   w  w w  .j  a  va 2 s  .  co  m*/
     * Returns a copy of the given list.
     * 
     * @param <T>
     *            Type of list elements
     * @param list
     *            List to copy
     * @return Copy of <code>list</code> containing the same elements
     */
    public static <T> List<T> copyOf(List<T> list) {
        List<T> result = new ArrayList<>(list.size());
        result.addAll(list);
        return result;
    }
}

Related

  1. copyListOnlySpecified(List list, int[] indexes)
  2. copyListRaw(List master, List slave)
  3. copyNullable(List original)
  4. copyNullSafeMutableList(Collection list)
  5. copyObjectList(List objects)
  6. copyOf(List values)
  7. copyOfRange(List list, int from, int to)
  8. copyProbabilities(List targetProbs, List destinationProbs)
  9. copyQueryFilters(List queryFilters)

  10. HOME | Copyright © www.java2s.com 2016