Package dev.nm.misc
Class ArrayUtils
- java.lang.Object
-
- dev.nm.misc.ArrayUtils
-
public final class ArrayUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T[]leftShift(T[] arr)Get a left shifted array.static <T> voidreverse(T[] arr)Reverse an array in place.static <T> T[]rightShift(T[] arr)Get a right shifted array.
-
-
-
Method Detail
-
leftShift
public static <T> T[] leftShift(T[] arr)
Get a left shifted array. The rightmost element is filled by anull.- Type Parameters:
T- a generic class type- Parameters:
arr- an array- Returns:
- a left shifted array
-
rightShift
public static <T> T[] rightShift(T[] arr)
Get a right shifted array. The leftmost element is filled by anull.- Type Parameters:
T- a generic class type- Parameters:
arr- an array- Returns:
- a right shifted array
-
reverse
public static <T> void reverse(T[] arr)
Reverse an array in place.- Type Parameters:
T- a generic class type- Parameters:
arr- an array
-
-