Here you can find the source of asList(final T[] input)
Parameter | Description |
---|---|
input | a parameter |
public static final <T> List<T> asList(final T[] input)
//package com.java2s; //License from project: LGPL import java.util.ArrayList; import java.util.List; public class Main { /**/*w ww . j a va2 s.c o m*/ * Return an ArrayList. * @param input * @return */ public static final <T> List<T> asList(final T[] input) { final List<T> out = new ArrayList<T>(input.length); for (int i = 0; i < input.length; i++) { out.add(input[i]); } return out; } /** * Return an ArrayList. * @param input * @return */ public static final List<Integer> asList(final int[] input) { final List<Integer> out = new ArrayList<Integer>(input.length); for (int i = 0; i < input.length; i++) { out.add(input[i]); } return out; } /** * Return an ArrayList. * @param input * @return */ public static final List<Long> asList(final long[] input) { final List<Long> out = new ArrayList<Long>(input.length); for (int i = 0; i < input.length; i++) { out.add(input[i]); } return out; } /** * Return an ArrayList. * @param input * @return */ public static final List<Double> asList(final double[] input) { final List<Double> out = new ArrayList<Double>(input.length); for (int i = 0; i < input.length; i++) { out.add(input[i]); } return out; } /** * Return an ArrayList. * @param input * @return */ public static final List<Float> asList(final float[] input) { final List<Float> out = new ArrayList<Float>(input.length); for (int i = 0; i < input.length; i++) { out.add(input[i]); } return out; } /** * Return an ArrayList. * @param input * @return */ public static final List<Boolean> asList(final boolean[] input) { final List<Boolean> out = new ArrayList<Boolean>(input.length); for (int i = 0; i < input.length; i++) { out.add(input[i]); } return out; } }