Class Arrays

java.lang.Object
org.fest.swing.util.Arrays

public final class Arrays extends Object
Understands utility methods for arrays.
  • Field Details

  • Constructor Details

    • Arrays

      private Arrays()
  • Method Details

    • equal

      public static boolean equal(String[][] one, String[][] two)
      Verifies that the given String arrays are equal.
      Parameters:
      one - the first array.
      two - the second array.
      Returns:
      true if the arrays are equal, false otherwise.
    • format

      public static String format(String[][] array)
      Formats a two-dimensional String array. For example, the array:
       String[][] array = {
            { "0-0", "0-1", "0-2" },
            { "1-0", "1-1", "1-2" },
            { "2-0", "2-1", "2-2" },
            { "3-0", "3-1", "3-2" }, };
       
      will be formatted as:
       [['0-0', '0-1', '0-2'],
        ['1-0', '1-1', '1-2'],
        ['2-0', '2-1', '2-2'],
        ['3-0', '3-1', '3-2']]
       
      Parameters:
      array - the array to format.
      Returns:
      the data of the given array formatted to make it easier to read.
    • addLine

      private static void addLine(String[] line, StringBuilder b)
    • copyOf

      public static int[] copyOf(int[] array)
      Creates and returns a copy of the given array.
      Parameters:
      array - the array to copy.
      Returns:
      the created copy.
      Throws:
      NullPointerException - if the array to copy is null.
    • copyOf

      public static <T> T[] copyOf(T[] array)
      Creates and returns a copy of the given array.
      Type Parameters:
      T - the generic type of the array.
      Parameters:
      array - the array to copy.
      Returns:
      the created copy.
      Throws:
      NullPointerException - if the array to copy is null.
    • isEmptyIntArray

      public static boolean isEmptyIntArray(int[] array)
      Indicates whether the given array is null or empty.
      Parameters:
      array - the array to check.
      Returns:
      true if the given array is null or empty; false otherwise.