@@ -0,0 +1,1695 @@
+/*%0A * Copyright (C) 2014- now() The  openSourcLibrary-2015  Authors%0A *%0A * https://github.com/sdcuike%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.doctor.java8;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.stream.Collectors;%0A%0A/**%0A * @author doctor%0A *%0A * @time 2015%E5%B9%B48%E6%9C%8811%E6%97%A5 %E4%B8%8B%E5%8D%8811:49:22%0A */%0Apublic class PartitioningTheData %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09List%3CInteger%3E list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 22, 55, 33);%0A%09%09Map%3CBoolean, List%3CInteger%3E%3E map = list.stream().collect(Collectors.partitioningBy(t -%3E Integer.compare(t, 10) %3E 0));%0A%09%09System.out.println(map.get(Boolean.TRUE));%0A%09%09System.out.println(map.get(Boolean.FALSE));%0A%0A%09%09Map%3CBoolean, Long%3E map2 = list.stream().collect(Collectors.partitioningBy(t -%3E Integer.compare(t, 10) %3E 0, Collectors.counting()));%0A%09%09System.out.println(map2.get(Boolean.TRUE));%0A%09%09System.out.println(map2.get(Boolean.FALSE));%0A%0A%09%09Map%3CBoolean, Integer%3E map3 = list.stream().collect(Collectors.partitioningBy(t -%3E Integer.compare(t, 10) %3E 0, Collectors.summingInt((Integer t) -%3E t)));%0A%09%09System.out.println(map3.get(Boolean.TRUE));%0A%09%09System.out.println(map3.get(Boolean.FALSE));%0A%09%7D%0A%0A%7D%0A

Partitioning The Data