本文整理了Java中java.util.ArrayList.parallelStream()
方法的一些代码示例,展示了ArrayList.parallelStream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayList.parallelStream()
方法的具体详情如下:
包路径:java.util.ArrayList
类名称:ArrayList
方法名:parallelStream
暂无
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public void parallel_lazy_jdk()
{
Map<Alphagram, List<String>> groupBy = this.jdkWords.parallelStream().collect(Collectors.groupingBy(Alphagram::new));
groupBy.entrySet()
.parallelStream()
.map(Map.Entry::getValue)
.filter(list -> list.size() >= SIZE_THRESHOLD)
.sorted(Comparator.<List<String>>comparingInt(List::size).reversed())
.map(list -> list.size() + ": " + list)
.forEach(e -> Assert.assertFalse(e.isEmpty()));
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position maxByQuantity_parallel_lazy_direct_methodref_jdk()
{
return this.positions.getJdkPositions().parallelStream().max(
QUANTITY_COMPARATOR_METHODREF).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position minByQuantity_parallel_lazy_direct_methodref_jdk()
{
return this.positions.getJdkPositions().parallelStream().min(
QUANTITY_COMPARATOR_METHODREF).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position maxByMarketValue_parallel_lazy_direct_methodref_jdk()
{
return this.positions.getJdkPositions().parallelStream().max(
MARKET_VALUE_COMPARATOR_METHODREF).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position minByQuantity_parallel_lazy_direct_lambda_jdk()
{
return this.positions.getJdkPositions().parallelStream().min(
QUANTITY_COMPARATOR_LAMBDA).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position maxByMarketValue_parallel_lazy_direct_lambda_jdk()
{
return this.positions.getJdkPositions().parallelStream().max(
MARKET_VALUE_COMPARATOR_LAMBDA).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position maxByQuantity_parallel_lazy_direct_lambda_jdk()
{
return this.positions.getJdkPositions().parallelStream().max(
QUANTITY_COMPARATOR_LAMBDA).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position minByMarketValue_parallel_lazy_direct_methodref_jdk()
{
return this.positions.getJdkPositions().parallelStream().min(
MARKET_VALUE_COMPARATOR_METHODREF).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position maxByMarketValue_parallel_lazy_collect_methodref_jdk()
{
return this.positions.getJdkPositions().parallelStream().collect(
Collectors.maxBy(MARKET_VALUE_COMPARATOR_METHODREF)).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position maxByMarketValue_parallel_lazy_collect_lambda_jdk()
{
return this.positions.getJdkPositions().parallelStream().collect(
Collectors.maxBy(MARKET_VALUE_COMPARATOR_LAMBDA)).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position minByQuantity_parallel_lazy_collect_lambda_jdk()
{
return this.positions.getJdkPositions().parallelStream().collect(
Collectors.minBy(QUANTITY_COMPARATOR_LAMBDA)).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Map<Product, DoubleSummaryStatistics> aggregateByProduct_parallel_lazy_jdk()
{
Map<Product, DoubleSummaryStatistics> result =
this.jdkPositions.parallelStream().collect(
Collectors.groupingBy(
Position::getProduct,
Collectors.summarizingDouble(Position::getMarketValue)));
Assert.assertNotNull(result);
return result;
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Map<String, Double> sumByCategory_parallel_lazy_jdk()
{
return this.positions.getJdkPositions().parallelStream().collect(
Collectors.groupingBy(
Position::getCategory,
Collectors.summingDouble(Position::getMarketValue)));
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position maxByQuantity_parallel_lazy_collect_methodref_jdk()
{
return this.positions.getJdkPositions().parallelStream().collect(
Collectors.maxBy(QUANTITY_COMPARATOR_METHODREF)).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Map<Account, Double> sumByAccount_parallel_lazy_jdk()
{
return this.positions.getJdkPositions().parallelStream().collect(
Collectors.groupingBy(
Position::getAccount,
Collectors.summingDouble(Position::getMarketValue)));
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position maxByQuantity_parallel_lazy_collect_lambda_jdk()
{
return this.positions.getJdkPositions().parallelStream().collect(
Collectors.maxBy(QUANTITY_COMPARATOR_LAMBDA)).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position minByQuantity_parallel_lazy_collect_methodref_jdk()
{
return this.positions.getJdkPositions().parallelStream().collect(
Collectors.minBy(QUANTITY_COMPARATOR_METHODREF)).get();
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Map<String, DoubleSummaryStatistics> aggregateByCategory_parallel_lazy_jdk()
{
Map<String, DoubleSummaryStatistics> result =
this.jdkPositions.parallelStream().collect(
Collectors.groupingBy(Position::getCategory, Collectors.summarizingDouble(Position::getMarketValue)));
Assert.assertNotNull(result);
return result;
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Map<Product, Double> sumByProduct_parallel_lazy_jdk()
{
return this.positions.getJdkPositions().parallelStream().collect(
Collectors.groupingBy(
Position::getProduct,
Collectors.summingDouble(Position::getMarketValue)));
}
代码示例来源:origin: goldmansachs/gs-collections
@Benchmark
public Position minByMarketValue_parallel_lazy_collect_methodref_jdk()
{
return this.positions.getJdkPositions().parallelStream().collect(
Collectors.minBy(MARKET_VALUE_COMPARATOR_METHODREF)).get();
}
内容来源于网络,如有侵权,请联系作者删除!