org.fest.swing.util
Class Arrays

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

public final class Arrays
extends Object

Understands utility methods for arrays.

Author:
Alex Ruiz

Method Summary
static int[] copyOf(int[] array)
          Creates and returns a copy of the given array.
static
<T> T[]
copyOf(T[] array)
          Creates and returns a copy of the given array.
static boolean equal(String[][] one, String[][] two)
          Verifies that the given String arrays are equal.
static String format(String[][] array)
          Formats a two-dimensional String array.
static boolean isEmptyIntArray(int[] array)
          Indicates whether the given array is null or empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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.

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.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.