Java List from listOf(A[] objs)

Here you can find the source of listOf(A[] objs)

Description

list Of

License

Open Source License

Declaration

public static <A> List<A> listOf(A[] objs) 

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 <A> List<A> listOf(A[] objs) {
        List<A> list = new ArrayList<A>();

        for (A a : objs)
            list.add(a);//from  w  w w  .ja  va 2 s. c o  m

        return list;
    }

    public static List<Integer> listOf(int[] objs) {
        List<Integer> list = new ArrayList<Integer>();

        for (int a : objs)
            list.add(a);

        return list;
    }

    public static List<Character> listOf(char[] objs) {
        List<Character> list = new ArrayList<Character>();

        for (char a : objs)
            list.add(a);

        return list;
    }
}

Related

  1. listOf(A... values)
  2. listOf(Class type)
  3. listOf(Collection coll)
  4. listOf(Collection collection, T... elements)
  5. listOf(Collection... elts)