`
jz_2017
  • 浏览: 5856 次
社区版块
存档分类
最新评论

GroupingBy with multiple columns

    博客分类:
  • Java
阅读更多

Below is learnt from my colleague. Next time i wish i can solve it independently.

 

import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.reducing;
import static java.util.stream.Collectors.toList;

import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
...

list.stream().collect(groupingBy(item -> item.getType() + item.getLevel(),
                reducing(Item::summarize))) // summarize: static function to aggregate items
        .values().stream().map(Optional::get)
        .collect(toList());

 

 

 

 

 

分享到:
评论

相关推荐

    Excel.2013.Working.with.Data.Ranges.and.Tables

    Next you learn how to sort a data range on one column or on multiple columns and how to use a custom sort order, the Filter (AutoFilter) feature and the Advanced Filter feature to view data that meets...

    TMS Pack for FireMonkey2.3.0.1

    Fixed : Issue with border width in new columns persistence collection in TTMSFMXGrid Fixed : Issue with bitmap assignment in TTMSFMXTableView Fixed : Issue with clearing cells in TTMSFMXGrid v2.0....

    Pandas Cookbook 2017 pdf 2分

    Grouping and aggregating with multiple columns and functions Getting ready How to do it... How it works... There's more... Removing the MultiIndex after grouping Getting ready How to do it... How it ...

    Foundations for Analytics with Python O-Reilly-2016-Clinton W. Brownley

    It transitions to an illustration of potential problems with this method of parsing and then presents an example of how to avoid these potential problems by parsing a CSV file with Python’s csv ...

    SSD7 选择题。Multiple-Choice

    View Assessment Result: Multiple-Choice Quiz 2 Your performance was as follows: 1. The degree of a table is the number of _____ in the table. (a) keys (b) columns (c) rows (d) ...

    FastReport.v4.15 for.Delphi.BCB.Full.Source企业版含ClientServer中文修正版支持D4-XE5

    - fixed bug in ODF export with properties table:number-columns-spanned, table:number-rows-spanned - fixed bug in ODF export with the background clNone color - fixed bug in ODF export with a style of ...

    oracle advanced sql 高级SQL教程 ORACLE官方教材

    GROUP BY with ROLLUP and CUBE Operators 3-6 ROLLUP Operator 3-7 ROLLUP Operator Example 3-8 CUBE Operator 3-9 CUBE Operator: Example 3-10 GROUPING Function 3-11 GROUPING Function: Example 3-12 ...

    微软内部资料-SQL性能优化5

    With a multitable query, SQL Server must sometimes search a table multiple times so each page is scanned much more than once. Having useful indexes speeds up finding individual rows in a table, as ...

    Dundas.Chart.for.Winform.Enterprise.v7.1.0.1812.for.VS2008

    Multiple Axis Support -Multiple Axis allows for greater control and flexibility when dealing with data. Each sub axis can be customized using its properties to meet your needs. Horizontal Error Bars -...

    Sql for mysql

    5.4 Assigning Names to Result Columns . . . . . . . . . . . . . . . . . . . . 92 5.5 The Column Specification. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 5.6 The User Variable and the ...

    Database Processing Fundamentals, Design, and Implementation (12th Edition).rar

    Querying Multiple Tables with Subqueries Querying Multiple Tables with Joins Comparing Subqueries and Joins Summary Key Terms Review Questions Project Questions Marcia's Dry Cleaning Morgan Importing ...

    Delphi7.1 Update

    * When multiple indexes are included with the data from a provider, the IndexDef entries in the TClientDataset will show duplicate ‘Fields‘ and ‘DescFields‘ values (Quality Central 7543)....

    Hibernate 中文 html 帮助文档

    15.7. 投影(Projections)、聚合(aggregation)和分组(grouping) 15.8. 离线(detached)查询和子查询 15.9. 根据自然标识查询(Queries by natural identifier) 16. Native SQL查询 16.1. 使用SQLQuery 16.1.1. 标量...

    Hibernate参考文档

    15.7. 投影(Projections)、聚合(aggregation)和分组(grouping) 15.8. 离线(detached)查询和子查询 15.9. 根据自然标识查询(Queries by natural identifier) 16. Native SQL查询 16.1. 使用SQLQuery 16.1.1. 标量...

Global site tag (gtag.js) - Google Analytics