本文整理了Java中org.n52.janmayen.function.Functions.mergeLeft()
方法的一些代码示例,展示了Functions.mergeLeft()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Functions.mergeLeft()
方法的具体详情如下:
包路径:org.n52.janmayen.function.Functions
类名称:Functions
方法名:mergeLeft
暂无
代码示例来源:origin: org.n52.janmayen/janmayen
public static <T, R> Collector<T, ?, R> collector(Supplier<R> supplier,
BiConsumer<R, T> accumulator,
BiConsumer<R, R> combiner) {
BinaryOperator<R> binaryOperator = Functions.mergeLeft(combiner);
return Collector.of(supplier, accumulator, binaryOperator);
}
代码示例来源:origin: org.n52.janmayen/janmayen
public static <T, A, R> Collector<T, ?, R> collector(Supplier<A> supplier,
BiConsumer<A, T> accumulator,
BiConsumer<A, A> combiner,
Function<A, R> finisher) {
BinaryOperator<A> binaryOperator = Functions.mergeLeft(combiner);
return Collector.of(supplier, accumulator, binaryOperator, finisher);
}
代码示例来源:origin: org.n52.janmayen/janmayen
public static <T> Collector<T, ?, T> toSingleResult(Supplier<? extends RuntimeException> exceptionSupplier) {
Objects.requireNonNull(exceptionSupplier);
Supplier<List<T>> supplier = LinkedList<T>::new;
BiConsumer<List<T>, T> accumulator = List<T>::add;
BinaryOperator<List<T>> combiner = Functions.mergeLeft(List::addAll);
Function<List<T>, T> finisher = list -> {
if (list.size() != 1) {
throw exceptionSupplier.get();
}
return list.get(0);
};
return Collector.of(supplier, accumulator, combiner, finisher, Characteristics.UNORDERED);
}
代码示例来源:origin: org.n52.janmayen/janmayen
public static <K, V> BinaryOperator<Map<K, V>> mergeToLeftMap(@Nonnull BinaryOperator<V> valueMerger) {
return mergeLeft(mapMerger(valueMerger));
}
代码示例来源:origin: 52North/SOS
public static <T extends Junction> Collector<Criterion, ?, T> toJunktion(Supplier<T> supplier) {
BiConsumer<T, Criterion> accumulator = Junction::add;
BinaryOperator<T> combiner = Functions.mergeLeft((d1, d2) -> Streams.stream(d2.conditions()).forEach(d1::add));
return Collector.of(supplier, accumulator, combiner, Collector.Characteristics.UNORDERED);
}
}
代码示例来源:origin: org.n52.sensorweb.sos/hibernate-utils
public static <T extends Junction> Collector<Criterion, ?, T> toJunktion(Supplier<T> supplier) {
BiConsumer<T, Criterion> accumulator = Junction::add;
BinaryOperator<T> combiner = Functions.mergeLeft((d1, d2) -> Streams.stream(d2.conditions()).forEach(d1::add));
return Collector.of(supplier, accumulator, combiner, Collector.Characteristics.UNORDERED);
}
}
代码示例来源:origin: 52North/SOS
map.merge(extension.getSectionName(),
(MergableExtension) extension,
Functions.mergeLeft(MergableExtension::merge));
} else {
extensions.add(extension);
代码示例来源:origin: 52North/SOS
@Override
public void recalculatePhenomenonTime() {
LOG.trace("Recalculating global phenomenon time based on offerings");
MinMax<DateTime> minMax = this.offerings.stream()
.map(offering -> new MinMax<>(getMinPhenomenonTimeForOffering(offering),
getMaxPhenomenonTimeForOffering(offering)))
.reduce(Functions.mergeLeft((a, b) -> a.extend(b, Comparator.naturalOrder())))
.orElseGet(MinMax::new);
if (!getOfferings().isEmpty() && minMax.getMinimum() == null || minMax.getMaximum() == null) {
LOG.error("Error in cache! Reset of global temporal bounding box failed. Max: '{}'; Min: '{}'",
minMax.getMaximum(), minMax.getMinimum());
}
setPhenomenonTime(minMax.getMinimum(), minMax.getMaximum());
LOG.trace("Global temporal bounding box reset done. Min: '{}'; Max: '{}'", getMinPhenomenonTime(),
getMaxPhenomenonTime());
}
代码示例来源:origin: org.n52.sensorweb.sos/cache
@Override
public void recalculatePhenomenonTime() {
LOG.trace("Recalculating global phenomenon time based on offerings");
MinMax<DateTime> minMax = this.offerings.stream()
.map(offering -> new MinMax<>(getMinPhenomenonTimeForOffering(offering),
getMaxPhenomenonTimeForOffering(offering)))
.reduce(Functions.mergeLeft((a, b) -> a.extend(b, Comparator.naturalOrder())))
.orElseGet(MinMax::new);
if (!getOfferings().isEmpty() && minMax.getMinimum() == null || minMax.getMaximum() == null) {
LOG.error("Error in cache! Reset of global temporal bounding box failed. Max: '{}'; Min: '{}'",
minMax.getMaximum(), minMax.getMinimum());
}
setPhenomenonTime(minMax.getMinimum(), minMax.getMaximum());
LOG.trace("Global temporal bounding box reset done. Min: '{}'; Max: '{}'", getMinPhenomenonTime(),
getMaxPhenomenonTime());
}
内容来源于网络,如有侵权,请联系作者删除!