提交 09d938ed 编写于 作者: 武汉红喜's avatar 武汉红喜

lambda

上级 45e2db39
package org.hongxi.whatsmars.base;
package org.hongxi.whatsmars.base.collection;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
......
......@@ -4,11 +4,8 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.partitioningBy;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.*;
/**
* Created by shenhongxi on 2018/1/11.
......@@ -36,7 +33,7 @@ public class Test {
Map<Status, List<Task>> map = tasks.stream().collect(groupingBy(Task::getStatus));
System.out.println(map);
Map<Status, Long> map2 = tasks.stream().collect(groupingBy(Task::getStatus, Collectors.counting()));
Map<Status, Long> map2 = tasks.stream().collect(groupingBy(Task::getStatus, counting()));
System.out.println(map2);
Map<Boolean, List<Task>> map3 = tasks.stream().collect(partitioningBy(e -> e.getPoint() > 7));
System.out.println(map3);
......
......@@ -9,7 +9,7 @@ import java.util.Map;
/**
* Created by shenhongxi on 2017/8/21.
*/
public class CommonTest {
public class ObjectMapperTest {
@Test
public void t() throws Exception {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册