Java Array to List toList(T[] _array)

Here you can find the source of toList(T[] _array)

Description

Generische Methode zum Umwandeln von Array in Listen

License

Open Source License

Parameter

Parameter Description
T a parameter
_array a parameter

Declaration

public static <T extends List<T>> List<T> toList(T[] _array) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.List;

public class Main {
    /**//from  w  w w  .  j  ava2 s. co m
     * Generische Methode zum Umwandeln von Array in Listen
     * 
     * @param <T>
     * @param _array
     * @return
     */
    public static <T extends List<T>> List<T> toList(T[] _array) {
        List<T> r = new ArrayList<T>();

        for (int i = 0, m = _array.length; i < m; i++) {
            r.add(_array[i]);
        }

        return r;
    }
}

Related

  1. toList(T value)
  2. toList(T... elements)
  3. toList(T... items)
  4. toList(T... objects)
  5. toList(T... objects)
  6. toList(T[] anArrayToConvert)
  7. toList(T[] arr)
  8. toList(T[] array)
  9. toList(T[] array)