一篇文章讲明白jav8特性特性应用

简介: 一篇文章讲明白jav8特性特性应用

List tableData = new ArrayList(1);

tableData = tableData.stream().sorted(Comparator.comparing(jsonObject -> StringNullUtil.isNotBlank((jsonObject).getString("id1Sort"))?(jsonObject).getInteger("id1Sort"):0)).collect(Collectors.toList());

List //代码效果参考:http://www.zidongmutanji.com/bxxx/446364.html

collect = deptAllList.stream().filter(dept -> dept.getDeptId().intValue() != dept.getParentId())

.sorted(Comparator.comparingInt(SysDept::getSort)).map(dept -> {

DeptTree node = new DeptTree();

node.setId(dept.getDeptId());

node.setParentId(dept.getParentId());

node.setName(dept.getName());

return node;

}).collect(Collectors.toList());

Map

//代码效果参考:http://www.zidongmutanji.com/bxxx/297284.html

.collect(Collectors.groupingBy(CatalogSystem::getName));

//list按逗号隔开,输出string

List msgList = new ArrayList();

msgList.stream().map(v->String.valueOf(v)).collect(Collectors.joining(";"))

Map map = userList.stream().collect(Collectors.toMap(User::getAge, User::getName, (a, b) -> b));

Map sysDeptMap=sysDeptList.//代码效果参考:http://www.zidongmutanji.com/bxxx/316494.html

stream().collect(Collectors.toMap(SysDept::getName, v -> v));

List roleMenuList = Arrays.stream(menuIds.split(",")).map(menuId -> {

相关文章
|
设计模式 编译器 Go
掌握Go类型内嵌:设计模式与架构的新视角2
掌握Go类型内嵌:设计模式与架构的新视角
82 0
|
设计模式 Cloud Native JavaScript
掌握Go类型内嵌:设计模式与架构的新视角1
掌握Go类型内嵌:设计模式与架构的新视角
80 0
|
Dart 开发者
带你读《深入浅出Dart》十、更多特性(1)
带你读《深入浅出Dart》十、更多特性(1)
|
8月前
一篇文章讲明白jav8特性特性应用
一篇文章讲明白jav8特性特性应用
390 0
带你读《深入浅出Dart》十、更多特性(2)
带你读《深入浅出Dart》十、更多特性(2)
|
编译器 C++ 容器
C++11常用的一部分新特性(下)
C++11常用的一部分新特性(下)
|
编译器 C语言
C++11常用的一部分新特性(中)
C++11常用的一部分新特性(中)
|
存储 安全 编译器
C++11常用的一部分新特性(上)
C++11常用的一部分新特性(上)
|
安全 编译器 程序员
【C++】C++补充知识&C++11及其特性
【C++】C++补充知识&C++11及其特性
【C++】C++补充知识&C++11及其特性
|
Java 开发者
传统属性赋值弊端 | 带你学《Java语言高级特性》之八十九
本节介绍了传统属性赋值的弊端--编码的重复性高,唯一的解决方案就是反射机制,反射机制最大的特征是可以根据其自身的特点实现相同功能类的重复操作的抽象处理。