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

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);
主站蜘蛛池模板: 偃师市| 宜黄县| 枝江市| 福安市| 桂阳县| 兴山县| 忻州市| 盐津县| 玛多县| 葫芦岛市| 汝阳县| 锦屏县| 赣榆县| 尖扎县| 红原县| 赣榆县| 保靖县| 阆中市| 雅安市| 香格里拉县| 栾城县| 海安县| 广河县| 晋江市| 巧家县| 莆田市| 城步| 汨罗市| 南皮县| 澄城县| 蓝山县| 调兵山市| 华容县| 疏附县| 广平县| 石林| 康定县| 彩票| 永泰县| 铅山县| 南丹县|