在Sonarcube中,将以下代码转换为Lambda时遇到错误,但遇到了困难。
private MeterFilter getDefualtConfig() {
return new MeterFilter() {
@Override
public DistributionStatisticConfig configure(Meter.Id id, DistributionStatisticConfig config) {
return DistributionStatisticConfig.builder().percentilesHistogram(true).percentiles(0.95, 0.99, .5)
.build().merge(config);
}
};
}
答案 0 :(得分:1)
相当于lambda为:
return (id, config) -> DistributionStatisticConfig.builder()
.percentilesHistogram(true)
.percentiles(0.95, 0.99, .5)
.build()
.merge(config);