Java Array to List toList(Object[] array)

Here you can find the source of toList(Object[] array)

Description

to List

License

Open Source License

Declaration

public static List toList(Object[] array) 

Method Source Code

//package com.java2s;

import java.util.ArrayList;

import java.util.Collections;

import java.util.List;

public class Main {
    public static List toList(Object[] array) {
        List list = Collections.EMPTY_LIST;
        if (array != null) {
            list = new ArrayList(array.length);
            for (int i = 0; i < array.length; i++) {
                list.add(array[i]);//from w w  w  .j  a va  2 s.  co  m
            }
        }
        return list;
    }

    public static List toList(Object obj) {
        ArrayList list = new ArrayList(1);
        list.add(obj);
        return list;
    }
}

Related

  1. toList(int[] from)
  2. toList(Object[] arr)
  3. toList(Object[] array)
  4. toList(Object[] array)
  5. toList(Object[] array)
  6. toList(Object[] array)
  7. toList(Object[] data)
  8. toList(Object[] input)
  9. toList(String[] anArray)