public class Collects extends Object
| 构造器和说明 |
|---|
Collects() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> List<T> |
concat(List<T> list,
T... array) |
static <S,T> List<T> |
convert(List<S> source,
Function<S,T> mapper) |
static <T> T |
get(List<T> list,
int index) |
static <T> T |
get(T[] array,
int index) |
static <T> T |
getFirst(List<T> list)
Gets the first element for list
|
static <T> T |
getLast(List<T> list)
Gets the last element for list
|
static <T> T[] |
newArray(Class<? extends T[]> newType,
int length) |
static List<int[]> |
partition(int[] array,
int size)
Returns consecutive sub array of an array,
each of the same size (the final list may be smaller).
|
public static <T> T getFirst(List<T> list)
T - the list element typelist - the listpublic static <T> T getLast(List<T> list)
T - the list element typelist - the listpublic static <T> T get(T[] array,
int index)
public static <T> T get(List<T> list, int index)
public static List<int[]> partition(int[] array, int size)
Collects.partition(new int[]{1,1,2,5,3}, 1) -> [1, 1, 2, 5, 3]
Collects.partition(new int[]{1,1,2,5,3}, 3) -> [1, 1]; [2, 5]; [3]
Collects.partition(new int[]{1,1,2,5,3}, 5) -> [1]; [1]; [2]; [5]; [3]
Collects.partition(new int[]{1,1,2,5,3}, 6) -> [1]; [1]; [2]; [5]; [3]
Collects.partition(new int[]{1,1,2,5,3}, 100) -> [1]; [1]; [2]; [5]; [3]
array - the arraysize - the size@SafeVarargs public static <T> List<T> concat(List<T> list, T... array)
public static <T> T[] newArray(Class<? extends T[]> newType, int length)
Copyright © 2023. All rights reserved.