hellokaton / 30-seconds-of-java8 Goto Github PK
View Code? Open in Web Editor NEW30 seconds to collect useful Java 8 snippet.
License: Creative Commons Zero v1.0 Universal
30 seconds to collect useful Java 8 snippet.
License: Creative Commons Zero v1.0 Universal
别致大佬,那个chuck函数好像有点小问题?
翻译的很好,请求转载。
/**
* 把 sourceList 的一些属性合并到 targetList 中
* 基于 testFunction 的条件,合入逻辑实现为 biConsumer
* @param targetList
* @param sourceList
* @param testFunction
* @param biConsumer
* @param <T>
* @param <S>
*/
public static <T, S> void merge(List<T> targetList, List<S> sourceList,
BiFunction<? super T, ? super S,Boolean> testFunction,
BiConsumer<? super T, ? super S> biConsumer) {
targetList.forEach((t)->{
Optional<S> optional = sourceList.stream().filter(s -> testFunction.apply(t,s)).findFirst();
if (optional.isPresent()) {
biConsumer.accept(t,optional.get());
}
});
}
lists.stream().collect(collectingAndThen(toCollection(() -> new TreeSet<>(Comparator.comparing(o -> Rmap.getStr(o,"orderId")))),
ArrayList::new));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.