Convert variable length array to list - Java Collection Framework

Java examples for Collection Framework:Array Convert

Description

Convert variable length array to list

Demo Code


//package com.java2s;

import java.util.Arrays;

import java.util.List;

public class Main {
    @SafeVarargs/*from  ww w.  j  av a2 s . c  o m*/
    public static <T> List<T> list(T... objects) {
        return Arrays.asList(objects);
    }
}

Related Tutorials