Package org.fest.swing.util
Class Arrays
java.lang.Object
org.fest.swing.util.Arrays
Understands utility methods for arrays.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddLine(String[] line, StringBuilder b) 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 booleanVerifies that the givenStringarrays are equal.static StringFormats a two-dimensionalStringarray.static booleanisEmptyIntArray(int[] array) Indicates whether the given array isnullor empty.
-
Field Details
-
NO_COLUMNS
- See Also:
-
NO_ROWS
- See Also:
-
NULL
- See Also:
-
-
Constructor Details
-
Arrays
private Arrays()
-
-
Method Details
-
equal
Verifies that the givenStringarrays are equal.- Parameters:
one- the first array.two- the second array.- Returns:
trueif the arrays are equal,falseotherwise.
-
format
Formats a two-dimensionalStringarray. 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
-
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 isnull.
-
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 isnull.
-
isEmptyIntArray
public static boolean isEmptyIntArray(int[] array) Indicates whether the given array isnullor empty.- Parameters:
array- the array to check.- Returns:
trueif the given array isnullor empty;falseotherwise.
-