Java List from Array asList(Object info)

Here you can find the source of asList(Object info)

Description

as List

License

Open Source License

Declaration

private static List<Number> asList(Object info) 

Method Source Code

//package com.java2s;

import java.util.ArrayList;

import java.util.List;

public class Main {
    private static List<Number> asList(Object info) {
        List<Number> list = new ArrayList<Number>();
        if (info instanceof int[]) {
            int[] array = (int[]) info;
            for (int i : array) {
                list.add(i);//w  ww.j  a  v  a2s  . c  o  m
            }
        } else if (info instanceof long[]) {
            long[] array = (long[]) info;
            for (long i : array) {
                list.add(i);
            }
        } else if (info instanceof float[]) {
            float[] array = (float[]) info;
            for (float i : array) {
                list.add(i);
            }
        } else if (info instanceof double[]) {
            double[] array = (double[]) info;
            for (double i : array) {
                list.add(i);
            }
        }
        return list;
    }
}

Related

  1. asList(Iterable iterable)
  2. asList(Iterable iterable)
  3. asList(Iterator iterator)
  4. asList(List list)
  5. asList(long... array)
  6. asList(Object o, Class cls)
  7. asList(Object theone)
  8. asList(Object value)
  9. asList(Object value)