提供给定集合的浅副本。
// 来自 时 代 J a v a - nowjava.com //package com.nowjava; import java.util.ArrayList; import java.util.Collection; import java.util.List; public class Main { /** * Provides a shallow copy of the given collection. * Removes all <code>null</code> items from <code>srcList</code>, * * @param srcList The source list. May be <code>null</code> and may contain <code>null</code> items. * @return A list with no <code>null</code> items. Never <code>null</code>. */ public static <T> List<T> shallowCopyWithoutNulls(Collection<T> srcList) { if (srcList == null) { return new ArrayList<T>(); } List<T> copy = new ArrayList<T>(srcList.size()); for (T t : srcList) {