Java List from Array convertArrayToList(int[] ids)

Here you can find the source of convertArrayToList(int[] ids)

Description

convert Array To List

License

Open Source License

Declaration

@SuppressWarnings({ "unchecked", "rawtypes" })
    public static List convertArrayToList(int[] ids) 

Method Source Code


//package com.java2s;
import java.util.ArrayList;
import java.util.List;

public class Main {
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static List convertArrayToList(int[] ids) {

        int i;/*from   w  ww  .  jav a  2s. c o m*/
        List result = null;
        if (ids != null) {
            result = new ArrayList();
            for (i = 0; i < ids.length; ++i)
                result.add(new Integer(ids[i]));
        }
        return result;
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static List convertArrayToList(String[] ids) {
        int i;
        List result = null;
        if (ids != null) {
            result = new ArrayList();
            for (i = 0; i < ids.length; ++i)
                result.add(new String(ids[i]));
        }
        return result;
    }
}

Related

  1. asList(T[] array)
  2. asList(T[] array)
  3. asList(T[] array)
  4. asList(T[] array)
  5. asListFromObjectArray(Object[] at)
  6. convertArrayToList(List list, String[] strs)
  7. convertArrayToList(Object value)
  8. convertArrayToList(Object[] objects)
  9. convertArrayToList(Object[] source)