com.github.lokic.javaplus.tuple
偷偷抛异常相关函数的package:com.github.lokic.javaplus.functional.sneakythrows
元组相关函数的package:com.github.lokic.javaplus.functional.tuple
Map.Entry 相关函数的package:com.github.lokic.javaplus.functional.entry
Supplier相关扩展:
Lazy
SneakyThrowsSupplier
ThrowsSupplier
Function相关扩展:
Functions
SneakyThrowsFunction1
SneakyThrowsFunction2
SneakyThrowsFunction3
TupleFunction2
TupleFunction3
TupleFunction4
TupleFunction5
TupleFunction6
EntryFunction
Consumer相关扩展:
Consumers
SneakyThrowsConsumer1
TupleConsumer2
TupleConsumer3
EntryConsumer
ThrowsConsumer1
Runnable 相关扩展:
SneakyThrowsRunnable
ThrowsRunnable
Optional 相关扩展:
Optionals
Stream 相关扩展:
Streams
Enum 相关扩展:
Property1
Property2
Property3
Predicate 相关扩展:
Predicates
EntryPredicate
TuplePredicate2
TuplePredicate3
Collectors 相关扩展:
Collectors.Reversed 倒序
Collectors.Distinct 去重
其他:
Types 类型相关
EntryFunction 、 EntryConsumer,
旨在减少使用 Map.Entry 传递的时候, Map.Entry.getKey() 、
Map.Entry.getValue() ()}的显性调用。keyExtractor, 来进行去重,只保存第一个值,之后的都忽略。keyExtractor 进行去重,只保存第一个值,之后的都忽略。t对应的class,在使用泛型的场景中,能够更加精确的获取对应的类型,而不需要手动进行一次转换
String s = ...;
// 之前的写法
Class<String> clazz = (Class<String>) s.getClass();
// 现在的写法
Class<String> clazz = Types.getClass(s);
object对应clazz的泛型,暂时支持只有一个泛型的类。Optional 只有 Optional.ifPresent(Consumer) 和 Optional.orElseGet(Supplier),
其中 Optional.orElseGet(Supplier) 必须要有返回值,必要的时候只能返回 Void 类型,不够优雅且冗余。biConsumer 中拿到遍历的下标biFunction 中拿到遍历的下标
List(...)
.stream()
.map(Functions.mapWithIndex((index, item) -> {
...
})
Function<T, Collection<R>> ==> Function<T,Stream<R>> Stream.empty()
在 Stream<T> 的流中,Stream.flatMap(Function) 的方法上,
通过该方法把 value 扁平化。Optional 对象 option 转成流 Stream,
如果为 Optional.empty(),则转换成 Stream.empty()
在 Stream<Optional<T>> 的流中,Stream.flatMap(Function) 的方法上,
通过该方法把 option 扁平化。Function<T, R> ==> Function<T,Stream<R>> finisher 转换Consumer<T> 转换 Function<T, Runnable>Stream 进行的一些方法扩展Copyright © 2022. All rights reserved.