Package jmri.util
Class ArrayUtil
java.lang.Object
jmri.util.ArrayUtil
Useful array methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic int[]appendArray(int[] first, int[] second) Combines two int arrays into a single array.static String[]appendArray(String[] first, String[] second) Combines two String arrays into a single array.static boolean[]reverse(boolean[] elementsArray) Reverse an array of booleans.static double[]reverse(double[] elementsArray) Reverse an array of doubles.static float[]reverse(float[] elementsArray) Reverse an array of floats.static int[]reverse(int[] elementsArray) Reverse an array of ints.static long[]reverse(long[] elementsArray) Reverse an array of longs.static <T> T[]reverse(T[] elementsArray) Reverse an array of objects.
-
Method Details
-
reverse
Reverse an array of objects.Not suitable for primitive types.
- Type Parameters:
T- the Type of the array contents- Parameters:
elementsArray- the array- Returns:
- the reversed array
-
reverse
Reverse an array of ints.- Parameters:
elementsArray- the array- Returns:
- the reversed array
-
reverse
Reverse an array of longs.- Parameters:
elementsArray- the array- Returns:
- the reversed array
-
reverse
Reverse an array of doubles.- Parameters:
elementsArray- the array- Returns:
- the reversed array
-
reverse
Reverse an array of floats.- Parameters:
elementsArray- the array- Returns:
- the reversed array
-
reverse
Reverse an array of booleans.- Parameters:
elementsArray- the array- Returns:
- the reversed array
-
appendArray
Combines two String arrays into a single array. No sorting, first comes before second.- Parameters:
first- the first String array to be combinedsecond- the second String array to be combined- Returns:
- a new String array containing all elements from both input arrays
-
appendArray
Combines two int arrays into a single array. No sorting, first comes before second.- Parameters:
first- the first int array to be combinedsecond- the second int array to be combined- Returns:
- new int array containing all elements from both input arrays
-