Package jmri.util
Class ArrayUtil
- java.lang.Object
-
- jmri.util.ArrayUtil
-
public final class ArrayUtil extends java.lang.Object
Useful array methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 Detail
-
reverse
public static <T> T[] reverse(@Nonnull T[] elementsArray)
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
public static int[] reverse(@Nonnull int[] elementsArray)
Reverse an array of ints.- Parameters:
elementsArray
- the array- Returns:
- the reversed array
-
reverse
public static long[] reverse(@Nonnull long[] elementsArray)
Reverse an array of longs.- Parameters:
elementsArray
- the array- Returns:
- the reversed array
-
reverse
public static double[] reverse(@Nonnull double[] elementsArray)
Reverse an array of doubles.- Parameters:
elementsArray
- the array- Returns:
- the reversed array
-
reverse
public static float[] reverse(@Nonnull float[] elementsArray)
Reverse an array of floats.- Parameters:
elementsArray
- the array- Returns:
- the reversed array
-
-