- Apache Spark 2.x for Java Developers
- Sourav Gulati Sumit Kumar
- 103字
- 2021-07-02 19:01:59
Partitioning
Partitioning is a special condition of grouping where the elements of the streams are partitioned based on the logic of the predicate function being passed to the Collectors. The predicate function based on a Boolean logic evaluates each element of the stream to either be true or false. The resultant output of the partitioningBy() method is a Map having two keys, true and false, and a list of values of streams associated with each Boolean value depending on the output of the predicate function:
//Partition Collectors
Map<Boolean,List<String>>partitionExample=streamSupplier.get().collect(Collectors.partitioningBy( x->x.toString().length() > 5 ));
System.out.println("Patitioning of elements on the basis of its length :: "+partitionExample);
推薦閱讀
- DB2 V9權(quán)威指南
- Java多線程編程實(shí)戰(zhàn)指南:設(shè)計(jì)模式篇(第2版)
- Apache ZooKeeper Essentials
- JavaScript語言精髓與編程實(shí)踐(第3版)
- Ext JS Data-driven Application Design
- 名師講壇:Spring實(shí)戰(zhàn)開發(fā)(Redis+SpringDataJPA+SpringMVC+SpringSecurity)
- RabbitMQ Essentials
- Spring Security Essentials
- 軟件測試綜合技術(shù)
- Python語言科研繪圖與學(xué)術(shù)圖表繪制從入門到精通
- Magento 2 Beginners Guide
- Python應(yīng)用與實(shí)戰(zhàn)
- Java EE項(xiàng)目應(yīng)用開發(fā)
- PHP典型模塊與項(xiàng)目實(shí)戰(zhàn)大全
- Python GUI設(shè)計(jì)tkinter菜鳥編程(增強(qiáng)版)