зеркало из
https://github.com/iharh/notes.git
synced 2025-10-30 21:26:09 +02:00
m
Этот коммит содержится в:
родитель
5ea4e00e7e
Коммит
9050d85aeb
@ -1 +1,31 @@
|
||||
https://openjdk.org/jeps/461
|
||||
|
||||
2024
|
||||
CodeWiz - Stream Gatherers 0:00 of 16:56
|
||||
https://www.youtube.com/watch?v=qBcuOCzvS3Y
|
||||
public static <T> Gatherer<T, List<T>, List<T>> getFixedWindowGatherer(int limit) {
|
||||
Supplier<List<T>> initializer = ArrayList::new;
|
||||
Gatherer.Integrator<List<T>, T, List<T>> integrator = (state, element, downstream) -> {
|
||||
state.add.element(element);
|
||||
if (state.size() == limit) {
|
||||
var group = List.copyOf(state);
|
||||
downstream.push(group);
|
||||
state.clear();
|
||||
}
|
||||
return true; // can consume more
|
||||
};
|
||||
BiConsumer<List<T>, Gatherer.Downstream<? super List<T>>> finisher = (state, downstream) -> {
|
||||
if (!state.isEmpty()) {
|
||||
downstream.push(List.copyOf(state));
|
||||
}
|
||||
};
|
||||
return Gatherer.ofSequential(initializer, integrator, finisher);
|
||||
}
|
||||
|
||||
List<List<...>> employeePairList = employees.stream()
|
||||
.filter(...)
|
||||
.map(Employee::name)
|
||||
.gather(getFixedWindowGatherer(2))
|
||||
.toList(); // [[Alice, Mary], [John, Ramesh], [Jen]]
|
||||
|
||||
// standard Gatherers: windowFixed, fold, scan, mapConcurrent, windowSliding
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
2024
|
||||
Devoxx - jbang - Unleash the power of Java by Max Rydahl Andersen of 31:34
|
||||
https://www.youtube.com/watch?v=cpKwBbz1sf0
|
||||
! catalog, edit, junit, ?profile
|
||||
2021
|
||||
Anderson - JBang: let's make Java fun to use again! 44:00 of 1:18:02
|
||||
https://www.youtube.com/watch?v=5Gf1Dswl-gs
|
||||
|
||||
Загрузка…
x
Ссылка в новой задаче
Block a user