Here you can find the source of toList(int[] array)
Parameter | Description |
---|---|
array | the array |
public static List<Integer> toList(int[] array)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /**/* w w w.jav a 2s .c o m*/ * Converts the given array of integers to a list of instances of class Integer * @param array the array * @return the list of instances of class Integer representing the original array */ public static List<Integer> toList(int[] array) { List<Integer> list = new ArrayList<Integer>(); for (int i : array) { list.add(i); } return list; } /** * Converts the given array of doubles to a list of instances of class Double * @param array the array * @return the list of instances of class Double representing the original array */ public static List<Double> toList(double[] array) { List<Double> list = new ArrayList<Double>(); for (double i : array) { list.add(i); } return list; } /** * Converts the given array of booleans to a list of instances of class Boolean * @param array the array * @return the list of instances of class Boolean representing the original array */ public static List<Boolean> toList(boolean[] array) { List<Boolean> list = new ArrayList<Boolean>(); for (boolean i : array) { list.add(i); } return list; } }