Java Collection Copy copy2Collection(Object[] strs)

Here you can find the source of copy2Collection(Object[] strs)

Description

copy Collection

License

MIT License

Declaration

public static Collection copy2Collection(Object[] strs) 

Method Source Code

//package com.java2s;
/**//  ww w .j  a v  a 2 s.  c om
 * Copyright (c) 2004-2011 Wang Jinbao(Julian Wong), http://www.ralasafe.com
 * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
 */

import java.util.ArrayList;

import java.util.Collection;

public class Main {
    public static Collection copy2Collection(Object[] strs) {
        Collection result = null;
        if (strs == null) {
            result = new ArrayList(0);
        } else {
            result = new ArrayList(strs.length);
            for (int i = 0; i < strs.length; i++) {
                // String s=strs[i];
                result.add(strs[i]);
            }
        }

        return result;
    }
}

Related

  1. copy(Collection args)
  2. copy(Collection collection)
  3. copy(final Collection in)
  4. copy(final Collection collection)
  5. copy(final Collection collection)
  6. copyColl(Collection out, Iterable set)
  7. copyIntoCollectionFrom(Collection collection, Iterable iterable)
  8. copyNSorted(final Collection source, final Collection dest, final Comparator order, final int n)
  9. copyRemainder(final T[] sourceArray, final int startIndex, final Collection collector)