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 void
addLine
(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 boolean
Verifies that the givenString
arrays are equal.static String
Formats a two-dimensionalString
array.static boolean
isEmptyIntArray
(int[] array) Indicates whether the given array isnull
or 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 givenString
arrays are equal.- Parameters:
one
- the first array.two
- the second array.- Returns:
true
if the arrays are equal,false
otherwise.
-
format
Formats a two-dimensionalString
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
-
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 isnull
or empty.- Parameters:
array
- the array to check.- Returns:
true
if the given array isnull
or empty;false
otherwise.
-