public class Lists extends Collections
Modifier and Type | Method and Description |
---|---|
static <E> List<E> |
as(Enumeration<E> iterator) |
static <E> List<E> |
as(Iterator<E> iterator) |
static <T> void |
copy(List<? extends T> src,
List<? super T> target)
拷贝集合
|
static <E> void |
cutAfter(List<E> list,
int len)
保留集合的前几位
|
static <E> void |
cutAround(List<E> list,
int start,
int len)
保留集合的中间几位
|
static <E> void |
cutBefore(List<E> list,
int len)
保留集合的后几位
|
static <E> List<E> |
def(List<E> list) |
static <E> List<E> |
def(List<E> list,
List<E> def) |
static <E> List<E> |
def(List<E> list,
Supplier<List<E>> def) |
static <E> List<E> |
distinct(Collection<E> c,
Function<E,?> keyGetter)
集合去重 -> list
|
static <E> List<E> |
empty() |
static boolean |
eq(List<?> list1,
List<?> list2)
集合是否相等
|
static <E> E |
get(List<E> list,
int i) |
static <E> E |
getIfPresent(List<E> list,
int i)
获取元素 如果元素存在
|
static <E> E |
getSet(List<E> list,
int i,
E e) |
static <E> int |
indexOf(List<E> list,
E e)
查找第一个查询到的元素的位置
|
static <E> int |
lastIndexOf(List<E> list,
E e)
查找最后一个查询到的元素的位置
|
static <E,V> List<E> |
map(List<V> list,
Function<V,E> mapper) |
static <E> void |
merge(List<E> source,
List<E>... listArray)
合并 list
|
static <E> List<E> |
newCopyOnWriteList() |
static <E> List<E> |
newCopyOnWriteList(Collection<? extends E> c) |
static <E> List<E> |
newCopyOnWriteList(E[] array) |
static <E> FixedArrayList<E> |
newFixedList(int limit) |
static <E> LimitList<E> |
newLimitList() |
static <E> LimitList<E> |
newLimitList(Collection<? extends E> c) |
static <E> LimitList<E> |
newLimitList(Collection<? extends E> c,
int limit) |
static <E> LimitList<E> |
newLimitList(int limit) |
static <E> LimitList<E> |
newLimitList(int initialCapacity,
int limit) |
static <E> LinkedList<E> |
newLinkedList() |
static <E> LinkedList<E> |
newLinkedList(Collection<? extends E> c) |
static <E> List<E> |
newList() |
static <E> List<E> |
newList(Collection<? extends E> c) |
static <E> List<E> |
newList(int capacity) |
static <E> MutableLinkedList<E> |
newMutableLinkedList() |
static <E> MutableLinkedList<E> |
newMutableLinkedList(Collection<? extends E> c) |
static <E> MutableArrayList<E> |
newMutableList() |
static <E> MutableArrayList<E> |
newMutableList(Collection<? extends E> c) |
static <E> MutableArrayList<E> |
newMutableList(int capacity) |
static <E> MutableVector<E> |
newMutableVector() |
static <E> MutableVector<E> |
newMutableVector(Collection<? extends E> c) |
static <E> MutableVector<E> |
newMutableVector(int initialCapacity) |
static <E> MutableVector<E> |
newMutableVector(int initialCapacity,
int capacityIncrement) |
static <E> List<E> |
newSynchronizedList() |
static <E> List<E> |
newSynchronizedList(List<E> list) |
static <E> List<E> |
of(E... values) |
static <E,V> List<E> |
of(Function<V,E> mapper,
V... values) |
static <E> List<List<E>> |
partition(List<E> list,
int size)
list 分片
|
static <E> E |
random(List<E> list)
从list随机获取一个元素
|
static <E> void |
removeToSize(List<E> list,
int size)
删除元素到指定大小
|
static <E> void |
reverse(List<E> list)
翻转集合
|
static <E> void |
set(List<E> list,
int i,
E e) |
static <E> void |
set(List<E> list,
int i,
E e,
boolean force) |
static <E> void |
setex(List<E> list,
int i,
E e) |
static <E> List<E> |
singleton(E e) |
static boolean[] |
toBooleans(List<Boolean> list) |
static byte[] |
toBytes(List<Byte> list) |
static char[] |
toChars(List<Character> list) |
static double[] |
toDoubles(List<Double> list) |
static float[] |
toFloats(List<Float> list) |
static int[] |
toInts(List<Integer> list) |
static long[] |
toLongs(List<Long> list) |
static short[] |
toShorts(List<Short> list) |
static <E> List<E> |
unmodified(List<E> list) |
compact, contains, containsAll, diff, diff, diffAll, exclude, fill, fill, fill, first, forEach, getDuplicateItems, getFirstDuplicateItem, inter, isAllEmpty, isEmpty, isNoneEmpty, isNotEmpty, join, join, join, last, max, max, min, min, newSynchronizedCollection, size, stream, union, unmodified
public static <E> List<E> newList()
public static <E> List<E> newList(int capacity)
public static <E> List<E> newList(Collection<? extends E> c)
public static <E> LinkedList<E> newLinkedList()
public static <E> LinkedList<E> newLinkedList(Collection<? extends E> c)
public static <E> MutableArrayList<E> newMutableList()
public static <E> MutableArrayList<E> newMutableList(int capacity)
public static <E> MutableArrayList<E> newMutableList(Collection<? extends E> c)
public static <E> MutableLinkedList<E> newMutableLinkedList()
public static <E> MutableLinkedList<E> newMutableLinkedList(Collection<? extends E> c)
public static <E> MutableVector<E> newMutableVector()
public static <E> MutableVector<E> newMutableVector(int initialCapacity)
public static <E> MutableVector<E> newMutableVector(int initialCapacity, int capacityIncrement)
public static <E> MutableVector<E> newMutableVector(Collection<? extends E> c)
public static <E> FixedArrayList<E> newFixedList(int limit)
public static <E> LimitList<E> newLimitList()
public static <E> LimitList<E> newLimitList(int limit)
public static <E> LimitList<E> newLimitList(int initialCapacity, int limit)
public static <E> LimitList<E> newLimitList(Collection<? extends E> c)
public static <E> LimitList<E> newLimitList(Collection<? extends E> c, int limit)
public static <E> List<E> newCopyOnWriteList()
public static <E> List<E> newCopyOnWriteList(E[] array)
public static <E> List<E> newCopyOnWriteList(Collection<? extends E> c)
public static <E> List<E> newSynchronizedList()
public static <E> List<E> singleton(E e)
public static <E> List<E> empty()
@SafeVarargs public static <E> List<E> of(E... values)
@SafeVarargs public static <E,V> List<E> of(Function<V,E> mapper, V... values)
public static <E> List<E> as(Enumeration<E> iterator)
public static <E> void cutAfter(List<E> list, int len)
E
- ignorelist
- 集合len
- 保留几位public static <E> void cutBefore(List<E> list, int len)
E
- ignorelist
- 集合len
- 保留几位public static <E> void cutAround(List<E> list, int start, int len)
E
- ignorelist
- 集合start
- 从哪位开始切len
- 保留几位@SafeVarargs public static <E> void merge(List<E> source, List<E>... listArray)
E
- ignoresource
- 合并到的 listlistArray
- 需要合并的 listpublic static <E> E random(List<E> list)
E
- ignorelist
- listpublic static <E> void reverse(List<E> list)
E
- ignorelist
- 集合public static <E> int indexOf(List<E> list, E e)
E
- ignorelist
- 集合e
- 元素public static <E> int lastIndexOf(List<E> list, E e)
E
- ignorelist
- 集合e
- 元素public static boolean eq(List<?> list1, List<?> list2)
list1
- ignorelist2
- ignorepublic static <E> void removeToSize(List<E> list, int size)
E
- Elist
- listsize
- 大小public static <E> List<List<E>> partition(List<E> list, int size)
E
- Elist
- listsize
- sizepublic static <E> List<E> distinct(Collection<E> c, Function<E,?> keyGetter)
E
- Ec
- ckeyGetter
- keyGetterpublic static <E> E getIfPresent(List<E> list, int i)
E
- Elist
- listi
- ipublic static <E> E get(List<E> list, int i)
public static <E> void set(List<E> list, int i, E e)
public static <E> void set(List<E> list, int i, E e, boolean force)
public static <E> void setex(List<E> list, int i, E e)
public static <E> E getSet(List<E> list, int i, E e)
Copyright © 2024. All rights reserved.