java.util.stream.Collectors.summingLong()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(224)

本文整理了Java中java.util.stream.Collectors.summingLong()方法的一些代码示例,展示了Collectors.summingLong()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collectors.summingLong()方法的具体详情如下:
包路径:java.util.stream.Collectors
类名称:Collectors
方法名:summingLong

Collectors.summingLong介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

/**
 * Computes the size of each store file in {@code storeFileNames}
 */
long getSizeOfStoreFiles(TableName tn, Set<StoreFileReference> storeFileNames) {
 return storeFileNames.stream()
   .collect(Collectors.summingLong((sfr) -> getSizeOfStoreFile(tn, sfr)));
}

代码示例来源:origin: Graylog2/graylog2-server

private TreeMap<DateTime, Long> aggregateToDaily(Map<DateTime, Long> histogram) {
  return histogram.entrySet().stream()
      .collect(Collectors.groupingBy(entry -> entry.getKey().withTimeAtStartOfDay(),
          TreeMap::new,
          Collectors.mapping(Map.Entry::getValue, Collectors.summingLong(Long::valueOf))));
}

代码示例来源:origin: apache/hbase

/**
 * Computes the size of the store files for a single region.
 */
long getSizeOfStoreFile(TableName tn, StoreFileReference storeFileName) {
 String regionName = storeFileName.getRegionName();
 return storeFileName.getFamilyToFilesMapping()
   .entries().stream()
   .collect(Collectors.summingLong((e) ->
     getSizeOfStoreFile(tn, regionName, e.getKey(), e.getValue())));
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Mono<Long> delete(Publisher<K> keys) {
  Assert.notNull(keys, "Keys must not be null!");
  return createFlux(connection -> connection.keyCommands() //
      .mDel(Flux.from(keys).map(this::rawKey).buffer(128)) //
      .map(CommandResponse::getOutput)) //
      .collect(Collectors.summingLong(value -> value));
}

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Mono<Long> unlink(Publisher<K> keys) {
  Assert.notNull(keys, "Keys must not be null!");
  return createFlux(connection -> connection.keyCommands() //
      .mUnlink(Flux.from(keys).map(this::rawKey).buffer(128)) //
      .map(CommandResponse::getOutput)) //
      .collect(Collectors.summingLong(value -> value));
}

代码示例来源:origin: apache/tinkerpop

public long longSize() {
  return this.map.values().stream().collect(Collectors.summingLong(Long::longValue));
}

代码示例来源:origin: com.tinkerpop/gremlin-core

public long longSize() {
  return this.map.values().stream().collect(Collectors.summingLong(Long::longValue));
}

代码示例来源:origin: org.apache.commons/commons-rdf-jsonld-java

@Override
public long size() {
  return rdfDataSet.graphNames().stream().map(rdfDataSet::getQuads)
      .collect(Collectors.summingLong(List::size));
}

代码示例来源:origin: org.jooq/jool

@Override
public long sumLong(ToLongFunction<? super T> function) {
  return collect(Collectors.summingLong(function));
}

代码示例来源:origin: radixdlt/radixdlt-java

public Map<Set<ECPublicKey>, Map<EUID, Long>> summary() {
  return getParticles().stream()
    .filter(Particle::isAbstractConsumable)
    .map(Particle::getAsAbstractConsumable)
    .collect(Collectors.groupingBy(
      AbstractConsumable::getOwnersPublicKeys,
      Collectors.groupingBy(
        AbstractConsumable::getAssetId,
        Collectors.summingLong(AbstractConsumable::getSignedQuantity)
      )
    ));
}

代码示例来源:origin: org.jooq/jool-java-8

@Override
public long sumLong(ToLongFunction<? super T> function) {
  return collect(Collectors.summingLong(function));
}

代码示例来源:origin: thorntail/thorntail

public void dump(long l, StringBuilder str) {
    long ms = this.children.stream()
        .collect(Collectors.summingLong(e -> e.durationMs()));

    str.append(String.format("%-80s...%s", this.description, Performance.formatTime(ms)));
    str.append("\n");
  }
}

代码示例来源:origin: org.graylog2/graylog2-server

private TreeMap<DateTime, Long> aggregateToDaily(Map<DateTime, Long> histogram) {
  return histogram.entrySet().stream()
      .collect(Collectors.groupingBy(entry -> entry.getKey().withTimeAtStartOfDay(),
          TreeMap::new,
          Collectors.mapping(Map.Entry::getValue, Collectors.summingLong(Long::valueOf))));
}

代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons

private long getTotalAssetSize(Asset asset) {
  long size = asset.getRenditions().stream().collect(Collectors.summingLong(r -> r.getSize()));
  if (includeSubassets && !asset.isSubAsset()) {
    size += DamUtil.getSubAssets(asset.adaptTo(Resource.class)).stream().collect(Collectors.summingLong(this::getTotalAssetSize));
  }
  return size;
}

代码示例来源:origin: org.apache.commons/commons-rdf-jena

@Override
public long size() {
  final long quads = Iter.asStream(datasetGraph.listGraphNodes())
      .map(datasetGraph::getGraph)
      .collect(Collectors.summingLong(org.apache.jena.graph.Graph::size));
  return quads + datasetGraph.getDefaultGraph().size();
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public Mono<Long> delete(Publisher<K> keys) {
  Assert.notNull(keys, "Keys must not be null!");
  return createFlux(connection -> connection.keyCommands() //
      .mDel(Flux.from(keys).map(this::rawKey).buffer(128)) //
      .map(CommandResponse::getOutput)) //
      .collect(Collectors.summingLong(value -> value));
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public Mono<Long> unlink(Publisher<K> keys) {
  Assert.notNull(keys, "Keys must not be null!");
  return createFlux(connection -> connection.keyCommands() //
      .mUnlink(Flux.from(keys).map(this::rawKey).buffer(128)) //
      .map(CommandResponse::getOutput)) //
      .collect(Collectors.summingLong(value -> value));
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Mono<Long> delete(Publisher<K> keys) {
  Assert.notNull(keys, "Keys must not be null!");
  return createFlux(connection -> connection.keyCommands() //
      .mDel(Flux.from(keys).map(this::rawKey).buffer(128)) //
      .map(CommandResponse::getOutput)) //
      .collect(Collectors.summingLong(value -> value));
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Mono<Long> unlink(Publisher<K> keys) {
  Assert.notNull(keys, "Keys must not be null!");
  return createFlux(connection -> connection.keyCommands() //
      .mUnlink(Flux.from(keys).map(this::rawKey).buffer(128)) //
      .map(CommandResponse::getOutput)) //
      .collect(Collectors.summingLong(value -> value));
}

代码示例来源:origin: fhoeben/hsac-fitnesse-fixtures

protected void writePieChartGeneratorBody(ChartWriter writer, List<TestReportHtml> htmls) {
  List<TestReportHtml> nonOverviews = filterBy(htmls, r -> !r.isOverviewPage());
  writeStatusPieChartGenerator(writer, nonOverviews);
  writer.writePieChartGenerator("Tests / Run", TESTCOUNT_CHART_ID, nonOverviews,
      r -> r.getRunName(), Collectors.counting());
  writer.writePieChartGenerator("Time / Run", RUNTIME_CHART_ID, nonOverviews,
      r -> r.getRunName(), Collectors.summingLong(r -> r.getTime() < 0 ? 0 : r.getTime()));
  writer.writeBarChartGenerator("ms / Test", TIME_PER_TEST_CHART_ID,
      ",hAxis:{textPosition:'none'}");
}

相关文章