Class ObjectArrays

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T[] concat​(@Nullable T element, T[] array)
      Returns a new array that prepends element to array.
      static <T> T[] concat​(T[] array, @Nullable T element)
      Returns a new array that appends element to array.
      static <T> T[] concat​(T[] first, T[] second, Class<T> type)
      Returns a new array that contains the concatenated contents of two arrays.
      static <T> T[] newArray​(Class<T> type, int length)
      Returns a new array of the given length with the specified component type.
      static <T> T[] newArray​(T[] reference, int length)
      Returns a new array of the given length with the same type as a reference array.
    • Method Detail

      • newArray

        @GwtIncompatible
        public static <T> T[] newArray​(Class<T> type,
                                       int length)
        Returns a new array of the given length with the specified component type.
        Parameters:
        type - the component type
        length - the length of the new array
      • newArray

        public static <T> T[] newArray​(T[] reference,
                                       int length)
        Returns a new array of the given length with the same type as a reference array.
        Parameters:
        reference - any array of the desired type
        length - the length of the new array
      • concat

        @GwtIncompatible
        public static <T> T[] concat​(T[] first,
                                     T[] second,
                                     Class<T> type)
        Returns a new array that contains the concatenated contents of two arrays.
        Parameters:
        first - the first array of elements to concatenate
        second - the second array of elements to concatenate
        type - the component type of the returned array
      • concat

        public static <T> T[] concat​(@Nullable T element,
                                     T[] array)
        Returns a new array that prepends element to array.
        Parameters:
        element - the element to prepend to the front of array
        array - the array of elements to append
        Returns:
        an array whose size is one larger than array, with element occupying the first position, and the elements of array occupying the remaining elements.
      • concat

        public static <T> T[] concat​(T[] array,
                                     @Nullable T element)
        Returns a new array that appends element to array.
        Parameters:
        array - the array of elements to prepend
        element - the element to append to the end
        Returns:
        an array whose size is one larger than array, with the same contents as array, plus element occupying the last position.