public final class ListUtil extends Object
| 构造器和说明 |
|---|
ListUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <E> void |
add(List<E> list,
E obj)
当list不包含obj时添加
|
static <E> void |
addAll(List<E> list1,
List<E> list2)
将list2添加到list1中(当list1不包含该项时)
|
static <E,K> int |
binarySearch(List<? extends E> list,
K key,
ComparatorExt<? super E,K> c)
对有序的list进行二分查找
|
static boolean |
contains(int[] arr,
int val) |
static boolean |
eq(List<?> l1,
List<?> l2)
比较list。
|
static <T> List<T> |
fill(T obj,
int count) |
static int |
indexOf(int[] arr,
int val) |
static boolean |
isEmpty(List<?> list)
列表是否为空
|
static <E> List<E> |
reverse(List<E> list)
反转list
|
static <E> List<E> |
toList(List<E> list)
安全的转换成list
|
static <E> List<E> |
toList(ResultPage<E> rp)
遍历ResultPage
|
static <E> List<E> |
union(List<E>... lists) |
static <E> List<E> |
union(List<List<E>> lists) |
public static boolean isEmpty(List<?> list)
list - public static <E> List<E> toList(ResultPage<E> rp)
rp - public static <E> void add(List<E> list, E obj)
list - obj - public static <E> void addAll(List<E> list1, List<E> list2)
list1 - list2 - public static <T> List<T> fill(T obj, int count)
public static int indexOf(int[] arr,
int val)
public static boolean contains(int[] arr,
int val)
public static boolean eq(List<?> l1, List<?> l2)
l1 - l2 - public static <E,K> int binarySearch(List<? extends E> list, K key, ComparatorExt<? super E,K> c)
E - K - list - key - c - key时,返回对应的下标;否则返回 (-(插入点) - 1)Copyright © 2020. All rights reserved.