public class ListUtil extends Object
| Constructor and Description |
|---|
ListUtil()
|
| Modifier and Type | Method and Description |
|---|---|
static <T> List |
appended(List
Create an unmodifiable list that contains the elements of the specified list plus the additional element append at its tail.
|
static boolean[] |
asBooleanArray(List
|
static byte[] |
asByteArray(List
|
static char[] |
asCharArray(List
|
static double[] |
asDoubleArray(List
|
static float[] |
asFloatArray(List
|
static int[] |
asIntArray(List
|
static long[] |
asLongArray(List
|
static short[] |
asShortArray(List
|
static <T> T |
last(List
Get the last element of the specified list list.
|
static <T> List |
prepended(List
Create an unmodifiable list that contains the elements of the specified list plus the additional element prepended at its front.
|
static <T> void |
shuffle(List
|
static <T> void |
swap(List
|
public static <T> void shuffle(List<T> list, int nswaps)
T - the type of the list (implicit).
list - the list to shuffle.
nswaps - the number of swaps to perform.
public static <T> void swap(List<T> list, int a, int b)
public static <T> List<T> prepended(List <T> list, T element)
public static <T> List<T> appended(List <T> list, T element)
public static <T> T last(List<T> list)