Class ArrayUtils

java.lang.Object
gaiasky.util.ArrayUtils

public class ArrayUtils extends Object
Utilities to work with arrays.
  • Constructor Details

    • ArrayUtils

      public ArrayUtils()
  • Method Details

    • concatWithArrayCopy

      public static <T> T[] concatWithArrayCopy(T[] array1, T[] array2)
      Concatenates the given arrays into a new array.
      Type Parameters:
      T - Array element types.
      Parameters:
      array1 - The first array.
      array2 - The second array.
      Returns:
      A new array which contains array1 + array2.
    • toFloatArray

      public static float[] toFloatArray(double[] arr)
      Convert a double array to a float array.
      Parameters:
      arr - The double array.
      Returns:
      The float array.
    • addString

      public static String[] addString(String[] original, String value)
      Returns a new array containing all elements of the original array plus the specified value appended at the end.

      Since Java arrays are immutable in size, this method creates a new array, copies the original contents, and adds the new value.

      Parameters:
      original - the source array; may be null
      value - the string to append to the array
      Returns:
      a new array containing the original elements and the appended value