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

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

Description

to List

License

Open Source License

Declaration

public static List<Double> toList(final double[] array) 

Method Source Code

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

import java.util.ArrayList;

import java.util.List;

public class Main {
    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]);// w ww.jav  a  2s.c  o m
        }
        return list;
    }

    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;
    }

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

    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;
    }
}

Related

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