public final class ToMap<K,V> extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
<T> T |
build() |
static <E,K,V> Map<K,V> |
collect(Stream<E> stream,
Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper)
如果流中具有重复的key又不想抛异常则使用该方法,否则使用对应的Collectors.toMap()即可
|
static <E,K,V> Map<K,V> |
collect(Stream<E> stream,
Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper,
boolean dummy) |
static <E,K,V> Map<K,V> |
collect(Stream<E> stream,
Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper,
boolean dummy,
int extra)
无法确定元素个数时的流收集
|
static <E,K,V> Map<K,V> |
collect(Stream<E> stream,
Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper,
int extra) |
static <E,K,V> Collector<E,?,Map<K,V>> |
collector(Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper) |
static <E,K,V,M extends Map<K,V>> |
collector(Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper,
BinaryOperator<V> mergeFunction,
Supplier<M> mapSupplier) |
static <E,K,V> Collector<E,?,Map<K,V>> |
collector(Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper,
boolean dummy)
无法确定元素个数时的收集器
|
static <E,K,V> Collector<E,?,Map<K,V>> |
collector(Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper,
int initialCapacity) |
static <E,K,V> Collector<E,?,Map<K,V>> |
collector(Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper,
int initialCapacity,
int idx) |
static <E,K,V> Collector<E,?,Map<K,V>> |
collector(Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper,
int initialCapacity,
int idx,
boolean dummy)
大致确定元素个数时的收集器
|
static <E,K,V,M extends Map<K,V>> |
collector(Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper,
Supplier<M> mapSupplier) |
static <E,K,V> Map<K,V> |
explicitCollect(Stream<E> stream,
Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper,
int initialCapacity) |
static <E,K,V> Map<K,V> |
explicitCollect(Stream<E> stream,
Function<? super E,? extends K> keyMapper,
Function<? super E,? extends V> valueMapper,
int initialCapacity,
int idx,
boolean dummy)
大致确定元素个数时的流收集
|
static <K,V> ToMap<K,V> |
get(int initialCapacity) |
static <K,V> ToMap<K,V> |
get(int initialCapacity,
int idx) |
static <K,V> ToMap<K,V> |
get(int initialCapacity,
int idx,
boolean dummy) |
<KK extends K,VV extends V> |
put(KK k,
VV v) |
ToMap<K,V> |
put(Map<? extends K,? extends V> m) |
static <E,K> Map<K,List<E>> |
topN(Collection<E> collection,
Function<E,TopInfo<K>> group,
Predicate<E> filter,
BiFunction<E,E,Integer> comparator) |
static <E,K> Map<K,List<E>> |
topN(Consumer<Consumer<E>> runnable,
Function<E,TopInfo<K>> group,
Predicate<E> filter,
BiFunction<E,E,Integer> comparator)
获取topN
|
static <E,K> Map<K,List<E>> |
topN(Supplier<E> supplier,
Function<E,TopInfo<K>> group,
Predicate<E> filter,
BiFunction<E,E,Integer> comparator) |
static <E,K> Map<K,E> |
topOne(Collection<E> collection,
Function<E,K> group,
Predicate<E> filter,
BiFunction<E,E,Integer> comparator) |
static <E,K> Map<K,E> |
topOne(Consumer<Consumer<E>> runnable,
Function<E,K> group,
Predicate<E> filter,
BiFunction<E,E,Integer> comparator) |
static <E,K> Map<K,E> |
topOne(Supplier<E> supplier,
Function<E,K> group,
Predicate<E> filter,
BiFunction<E,E,Integer> comparator) |
static <E,M extends Map<?,?>> |
unique(List<E> list,
Function<E,?>... classifiers)
分组列表
|
public static <K,V> ToMap<K,V> get(int initialCapacity, int idx, boolean dummy)
public static <K,V> ToMap<K,V> get(int initialCapacity, int idx)
public static <K,V> ToMap<K,V> get(int initialCapacity)
public <T> T build()
public static <E,K,V,M extends Map<K,V>> Collector<E,?,M> collector(Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper, BinaryOperator<V> mergeFunction, Supplier<M> mapSupplier)
public static <E,K,V,M extends Map<K,V>> Collector<E,?,M> collector(Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper, Supplier<M> mapSupplier)
public static <E,K,V> Collector<E,?,Map<K,V>> collector(Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper, int initialCapacity, int idx, boolean dummy)
keyMapper - 键映射器valueMapper - 值映射器initialCapacity - 大致确定的初始容量idx - 初始容量衰减次数dummy - 是否排序的public static <E,K,V> Collector<E,?,Map<K,V>> collector(Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper, int initialCapacity, int idx)
public static <E,K,V> Collector<E,?,Map<K,V>> collector(Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper, int initialCapacity)
public static <E,K,V> Map<K,V> explicitCollect(Stream<E> stream, Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper, int initialCapacity, int idx, boolean dummy)
public static <E,K,V> Map<K,V> explicitCollect(Stream<E> stream, Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper, int initialCapacity)
public static <E,K,V> Collector<E,?,Map<K,V>> collector(Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper, boolean dummy)
public static <E,K,V> Collector<E,?,Map<K,V>> collector(Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper)
public static <E,K,V> Map<K,V> collect(Stream<E> stream, Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper, boolean dummy, int extra)
extra - 申请额外空间public static <E,K,V> Map<K,V> collect(Stream<E> stream, Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper, boolean dummy)
public static <E,K,V> Map<K,V> collect(Stream<E> stream, Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper, int extra)
public static <E,K,V> Map<K,V> collect(Stream<E> stream, Function<? super E,? extends K> keyMapper, Function<? super E,? extends V> valueMapper)
@SafeVarargs public static <E,M extends Map<?,?>> M unique(List<E> list, Function<E,?>... classifiers)
list - 需要分组的数据classifiers - 分组函数集public static <E,K> Map<K,List<E>> topN(Consumer<Consumer<E>> runnable, Function<E,TopInfo<K>> group, Predicate<E> filter, BiFunction<E,E,Integer> comparator)
public static <E,K> Map<K,List<E>> topN(Supplier<E> supplier, Function<E,TopInfo<K>> group, Predicate<E> filter, BiFunction<E,E,Integer> comparator)
public static <E,K> Map<K,List<E>> topN(Collection<E> collection, Function<E,TopInfo<K>> group, Predicate<E> filter, BiFunction<E,E,Integer> comparator)
public static <E,K> Map<K,E> topOne(Consumer<Consumer<E>> runnable, Function<E,K> group, Predicate<E> filter, BiFunction<E,E,Integer> comparator)
public static <E,K> Map<K,E> topOne(Supplier<E> supplier, Function<E,K> group, Predicate<E> filter, BiFunction<E,E,Integer> comparator)
public static <E,K> Map<K,E> topOne(Collection<E> collection, Function<E,K> group, Predicate<E> filter, BiFunction<E,E,Integer> comparator)
Copyright © 2022. All rights reserved.