JDK8 lambda java.util.ArrayList
package lambda;public class Student
{private String code;private String name;public Student(){}public Student(String code, String name){this.code = code;this.name = name;}public String getCode(){return code;}public void setCode(String code){this.code = code;}public String getName(){return name;}public void setName(String name){this.name = name;}
}
package lambda.case_01_list;import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;import lambda.Student;public class TestList
{public TestList(){}public static void main(String[] args){Student s1 = new Student("005129", "zwf");Student s2 = new Student("005128", "zwf");List<Student> listStudent = new ArrayList<Student>();listStudent.add(s1);listStudent.add(s2);// Lambda 表达式和 Stream API 对象列表 转化 对象属性列表List<String> listCode = listStudent.stream().map(Student::getCode).collect(Collectors.toList());// Lambda 表达式和 Stream API 遍历列表listCode.forEach(str -> System.out.println(str));//-------------------------------------------// 向低版本兼容//-------------------------------------------// 将对象列表转化为对象属性列表List<String> listCode2 = new ArrayList<String>();for (Student student : listStudent){listCode2.add(student.getCode());}// 遍历列表for (String str : listCode2){System.out.println(str);}}}
我还是喜欢我的eclipse,简洁大方,框体布局主次明显【左,中上,中下,右】,这启动慢是因为我安装了这么多的工程!
花里胡哨,啥也不是,说真的这玩意,真的花里胡哨的,边框设计像素太多,框体太多,该工具也很消耗内存
最让我不恼火就是,这个控制台监控,随着service关闭就关闭了,
console和problem,是IDEA最重要的东西,主次不清。
Incompatible types. Found: ‘java.util.List<java.lang.Long>‘, required: ‘java.util.List<java.lang.Int-CSDN博客