Package jmri.util
Class ArrayUtil
- java.lang.Object
-
- jmri.util.ArrayUtil
-
public final class ArrayUtil extends java.lang.Object
Useful array methods.
-
-
Constructor Summary
Constructors Constructor Description ArrayUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean[]
reverse(boolean[] elements)
Reverse an array of booleans.static double[]
reverse(double[] elements)
Reverse an array of doubles.static float[]
reverse(float[] elements)
Reverse an array of floats.static int[]
reverse(int[] elements)
Reverse an array of ints.static long[]
reverse(long[] elements)
Reverse an array of longs.static <T> T[]
reverse(T[] elements)
Reverse an array of objects.
-
-
-
Constructor Detail
-
ArrayUtil
public ArrayUtil()
-
-
Method Detail
-
reverse
public static <T> T[] reverse(@Nonnull T[] elements)
Reverse an array of objects.Not suitable for primitive types.
- Type Parameters:
T
- the Type of the array contents- Parameters:
elements
- the array- Returns:
- the reversed array
-
reverse
public static int[] reverse(@Nonnull int[] elements)
Reverse an array of ints.- Parameters:
elements
- the array- Returns:
- the reversed array
-
reverse
public static long[] reverse(@Nonnull long[] elements)
Reverse an array of longs.- Parameters:
elements
- the array- Returns:
- the reversed array
-
reverse
public static double[] reverse(@Nonnull double[] elements)
Reverse an array of doubles.- Parameters:
elements
- the array- Returns:
- the reversed array
-
reverse
public static float[] reverse(@Nonnull float[] elements)
Reverse an array of floats.- Parameters:
elements
- the array- Returns:
- the reversed array
-
-