Convert an aggregate list of objects into a List - Java java.util

Java examples for java.util:List Convert

Description

Convert an aggregate list of objects into a List

Demo Code


//package com.java2s;
import java.util.ArrayList;

import java.util.List;

public class Main {
    /**/* w  ww  .  j  a  v a 2s.  c om*/
     * Convert an aggregate list of objects into a List
     */
    public static <T> List<T> getAggregate(T... objects) {
        List<T> objs = new ArrayList<T>();
        if (objects != null) {
            for (T obj : objects) {
                objs.add(obj);
            }
        }
        return objs;
    }
}

Related Tutorials