Java List Create asList(int[] a)

Here you can find the source of asList(int[] a)

Description

as List

License

Open Source License

Declaration

public static ArrayList asList(int[] a) 

Method Source Code


//package com.java2s;
/*/* w  ww . j a  va2 s .com*/
 * @(#)ArrayUtil.java  
 *
 * Copyright (c) 2003-2010 Werner Randelshofer
 * Hausmatt 10, Immensee, CH-6405, Switzerland
 * All rights reserved.
 *
 * The copyright of this software is owned by Werner Randelshofer. 
 * You may not use, copy or modify this software, except in  
 * accordance with the license agreement you entered into with  
 * Werner Randelshofer. For details see accompanying license terms. 
 */

import java.util.*;

public class Main {
    public static ArrayList asList(int[] a) {
        ArrayList list = new ArrayList(a.length);
        for (int i = 0; i < a.length; i++) {
            list.add(new Integer(a[i]));
        }
        return list;
    }
}

Related

  1. asList(Collection items)
  2. asList(E... elements)
  3. asList(E[] array)
  4. asList(final int... values)
  5. asList(final Iterator data)
  6. asList(int[] array)
  7. asList(Iterable iteratable)
  8. asList(Object[] array)
  9. asList(Object[] array)