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

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);
主站蜘蛛池模板: 五常市| 体育| 潞城市| 万全县| 蚌埠市| 册亨县| 石嘴山市| SHOW| 区。| 英超| 民丰县| 卓尼县| 武定县| 桂阳县| 祁门县| 开鲁县| 区。| 澄江县| 临清市| 余江县| 柏乡县| 泸定县| 卓资县| 马龙县| 太湖县| 会东县| 多伦县| 大余县| 青川县| 西安市| 哈尔滨市| 枣阳市| 盐亭县| 杂多县| 平遥县| 临泉县| 封开县| 荔波县| 准格尔旗| 安义县| 始兴县|