类 StreamUtil
java.lang.Object
org.dromara.dynamictp.common.util.StreamUtil
StreamUtil related
- 从以下版本开始:
- 1.0.0
- 作者:
- yanhom
-
方法概要
修饰符和类型方法说明static <I,T> List<I> fetchProperty(Collection<T> data, Function<T, I> mapping) Fetches id to list.toListMap(Collection<I> ids, Collection<D> list, Function<D, I> key) Converts a list to a list map where list contains id in ids.static <O,D, P> Map<O, P> toMap(Collection<D> list, Function<D, O> key, Function<D, P> value) Converts to map (key from the list data)static <P,O> Map<O, P> toMap(Collection<P> coll, Function<P, O> key) Converts to map (key from the list data)
-
方法详细资料
-
fetchProperty
Fetches id to list.- 类型参数:
I- id typeT- data type- 参数:
data- data collectionmapping- calculate the id in data list- 返回:
- a list of id
-
toMap
Converts to map (key from the list data)- 类型参数:
O- id typeP- data type- 参数:
coll- data listkey- key mapping function- 返回:
- a map which key from list data and value is data
-
toMap
Converts to map (key from the list data)- 类型参数:
O- id typeD- data typeP- value type- 参数:
list- data listkey- key mapping functionvalue- value mapping function- 返回:
- a map which key from list data and value is data
-
toListMap
public static <I,D> Map<I,List<D>> toListMap(Collection<I> ids, Collection<D> list, Function<D, I> key) Converts a list to a list map where list contains id in ids.- 类型参数:
I- id typeD- data type- 参数:
ids- id collectionlist- data listkey- calculate the id in data list- 返回:
- a map which key is in ids and value containing in list
-