Package com.Ostermiller.util
Class ArrayHelper
java.lang.Object
com.Ostermiller.util.ArrayHelper
Convenience methods for working with Java arrays.
More information about this class is available from ostermiller.org.
- Since:
- ostermillerutils 1.06.00
- Author:
- Stephen Ostermiller https://ostermiller.org/contact.pl?regarding=Java+Utilities
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object[]Concatenates the given arrays into a single long array.static booleanTests two arrays to see if the arrays are equal.static voidPrints out a comma separated list of all the objects in the array on a single line in CSV format.
-
Constructor Details
-
ArrayHelper
public ArrayHelper()
-
-
Method Details
-
cat
Concatenates the given arrays into a single long array. The returned array will be of the common super type of the two given arrays.For example it can be called like this:
String[] arr = (String[])ArrayHelper.cat(new String[]{"one","two"}, new String[]{"three","four"});- Parameters:
arr1- first arrayarr2- second array- Returns:
- an array whose length is the sum of the given array's lengths and contains all the elements in the given arrays.
- Since:
- ostermillerutils 1.06.00
-
print
Prints out a comma separated list of all the objects in the array on a single line in CSV format.- Parameters:
arr- Array to print in comma separated value format- Since:
- ostermillerutils 1.06.00
-
equal
Tests two arrays to see if the arrays are equal. Two arrays will be equal only if they are the same length and contain objects that are equal in the same order.- Parameters:
arr1- first arrayarr2- second array- Returns:
- true iff two arguments are equal
- Since:
- ostermillerutils 1.06.00
-