Java Array Create array(T... elements)

Here you can find the source of array(T... elements)

Description

Shortcurt to create an array of elements.

License

Apache License

Parameter

Parameter Description
elements The elements for which to create an array.
T The type of the elements (and array)

Return

An array of the given elements.

Declaration

public static <T> T[] array(T... elements) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//w  w  w.j ava  2s .  com
     * Shortcurt to create an array of elements.
     *
     * @param elements The elements for which to create an array.
     * @param <T> The type of the elements (and array)
     * @return An array of the given elements.
     */
    public static <T> T[] array(T... elements) {
        return elements;
    }
}

Related

  1. array(Object... objects)
  2. array(Object... val)
  3. array(String str)
  4. array(String... strings)
  5. array(T... ar)
  6. array(T... elems)
  7. array(T... ts)
  8. array(T... values)
  9. array(T... values)