Java List Copy copyNullSafeMutableList(Collection list)

Here you can find the source of copyNullSafeMutableList(Collection list)

Description

copy Null Safe Mutable List

License

LGPL

Declaration

public static <E> ArrayList<E> copyNullSafeMutableList(Collection<? extends E> list) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.util.ArrayList;
import java.util.Collection;

public class Main {
    public static <E> ArrayList<E> copyNullSafeMutableList(Collection<? extends E> list) {
        if (list == null)
            throw new NullPointerException("list");

        ArrayList<E> result = new ArrayList<E>(list);
        for (E element : result) {
            if (element == null)
                throw new NullPointerException("element");
        }/*from   w  w w .j  a  va 2  s .  c om*/
        return result;
    }
}

Related

  1. copyList(List original)
  2. copyList(Object object)
  3. copyListOnlySpecified(List list, int[] indexes)
  4. copyListRaw(List master, List slave)
  5. copyNullable(List original)
  6. copyObjectList(List objects)
  7. copyOf(List list)
  8. copyOf(List values)
  9. copyOfRange(List list, int from, int to)

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