Class ArrayJoiner
java.lang.Object
org.flag4j.util.ArrayJoiner
The
ArrayJoiner
class provides utility methods for combining and repeating arrays.
It simplifies operations involving concatenating and repeating arrays.
Example Usage:
// Join two arrays
int[] array1 = {1, 2, 3};
int[] array2 = {4, 5, 6};
int[] joinedArray = ArrayJoiner.join(array1, array2); // {1, 2, 3, 4, 5, 6}
// Repeat an array
int[] repeatedArray = ArrayJoiner.repeat(3, array1); // {1, 2, 3, 1, 2, 3, 1, 2, 3}
Note: This class is a utility class and cannot be instantiated.
-
Method Summary
-
Method Details
-
join
public static double[] join(double[] src1, double[] src2) Joins two arrays together.- Parameters:
src1
- First array to join.src2
- Second array to join.- Returns:
- A single array of length
src1.length + src2.length
containing the elements ofsrc1
followed by the elements ofsrc2
.
-
join
public static int[] join(int[] src1, int[] src2) Joins two arrays together.- Parameters:
src1
- First array to join.src2
- Second array to join.- Returns:
- A single array of length
src1.length + src2.length
containing the elements ofsrc1
followed by the elements ofsrc2
.
-
repeat
public static int[] repeat(int numTimes, int[] src) Repeats an array a specified number of times.- Parameters:
numTimes
- Number of times to repeat the array.src
- The source array to repeat.- Returns:
- The
src
array repeatednumTimes times
.
-