Java Array to List toList(final E[] array)

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

Description

to List

License

Open Source License

Declaration

@Deprecated
    public static <E> List<E> toList(final E[] array) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static <E> List<E> toList(final Enumeration<E> enumeration) {
        return Collections.list(enumeration);
    }//  w  ww . ja  va  2s  .c om

    @Deprecated
    public static <E> List<E> toList(final E[] array) {
        List<E> list = new ArrayList<E>(array.length);
        for (E e : array) {
            list.add(e);
        }
        return list;
    }

    @Deprecated
    public static List<Double> toList(final double[] array) {
        List<Double> list = new ArrayList<Double>(array.length);
        for (int i = 0; i < array.length; i++) {
            list.add(array[i]);
        }
        return list;
    }

    @Deprecated
    public static List<Integer> toList(final int[] array) {
        List<Integer> list = new ArrayList<Integer>(array.length);
        for (int i = 0; i < array.length; i++) {
            list.add(array[i]);
        }
        return list;
    }
}

Related

  1. toList(double[] array)
  2. toList(E... e)
  3. toList(E... values)
  4. toList(E[] array, int fromIndex, int toIndex)
  5. toList(final double[] array)
  6. toList(final float[] array)
  7. toList(final int[] array)
  8. toList(final int[] array)
  9. ToList(final Object[] array)