Java List from Array arrayToList(E[] array)

Here you can find the source of arrayToList(E[] array)

Description

array To List

License

Apache License

Declaration

public static <E> List<E> arrayToList(E[] array) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

import java.util.List;

public class Main {

    public static <E> List<E> arrayToList(E[] array) {
        List<E> list = new ArrayList<E>(array.length);
        for (int i = 0; i < array.length; i++) {
            list.add(array[i]);//  w w w  .j a  va2  s .  c o m
        }
        return list;
    }

    public static <E> List<E> arrayToList(E[] array, int size) {
        List<E> list = new ArrayList<E>(size);
        for (int i = 0; i < array.length; i++) {
            list.add(array[i]);
        }
        return list;
    }
}

Related

  1. arrayToInSQL(String column, List list)
  2. arrayToJsonStringArr(List arr)
  3. arrayToList(@SuppressWarnings("unchecked") T... a)
  4. arrayToList(char[] charArr)
  5. arrayToList(Comparable[] array)
  6. arrayToList(final String... array)
  7. arrayToList(int[] a)
  8. arrayToList(int[] array)
  9. arrayToList(int[] array)

  10. HOME | Copyright © www.java2s.com 2016