Java List Copy copyArrayToList(Object[] input, List output)

Here you can find the source of copyArrayToList(Object[] input, List output)

Description

copy Array To List

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    public static <T> List<T> copyArrayToList(Object[] input, List<T> output) 

Method Source Code

//package com.java2s;
/*/*from   w  w w.j  a  v  a 2  s  . c  o  m*/
Weave (Web-based Analysis and Visualization Environment)
Copyright (C) 2008-2011 University of Massachusetts Lowell
    
This file is a part of Weave.
    
Weave is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License, Version 3,
as published by the Free Software Foundation.
    
Weave is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with Weave.  If not, see <http://www.gnu.org/licenses/>.
*/

import java.util.List;

public class Main {
    @SuppressWarnings("unchecked")
    public static <T> List<T> copyArrayToList(Object[] input, List<T> output) {
        for (int i = 0; i < input.length; i++) {
            output.add((T) input[i]);
        }

        return output;
    }
}

Related

  1. copy(List toCopy)
  2. copy(List[] sourceLists, List[] destLists)
  3. copyAndClearList(List sourceList)
  4. copyAndRemove(final List in, final String remove)
  5. copyAndSet(final Map> in, final String key, final String value)
  6. copyFirst(List list, int count)
  7. copyIntArray(List li)
  8. copyInto(List source, List dest)
  9. copyList(Collection c)