官术网_书友最值得收藏!

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);
主站蜘蛛池模板: 威远县| 海口市| 阿拉尔市| 建湖县| 容城县| 察哈| 大埔区| 都安| 开封市| 武夷山市| 永定县| 尚志市| 邢台县| 连城县| 西藏| 濉溪县| 育儿| 荥经县| 仙游县| 花莲县| 肇庆市| 灵寿县| 闽清县| 德庆县| 武隆县| 渝北区| 定兴县| 准格尔旗| 长白| 阿克陶县| 巴马| 大厂| 且末县| 育儿| 万全县| 繁峙县| 宁安市| 梅河口市| 苏尼特左旗| 丹江口市| 黑龙江省|