标签:ret and ati ali com jdk rip app 对象
jdk8有哪些新特性
Integer[] is=new Integer[]{43,65,87,324,76,12,61,13};
Arrays.sort(is, new Comparator<Integer>() {
public int compare(Integer o1, Integer o2) {
return o2-o1;
}
});
使用lambda表达式之后是这样:
Integer[] is=new Integer[]{43,65,87,324,76,12,61,13};
Arrays.sort(is, (o1,o2) -> o2-o1);
System.out.println(Arrays.toString(is));
List names = new ArrayList();
names.add("ali");
names.add("xiaoli");
names.add("zhangli");
names.forEach(System.out::println);
public interface UserService {
// static修饰符定义静态方法,只能通过接口名称来调用
static void staticMethod() {
System.out.println("接口中的静态方法");
}
// default修饰符定义默认方法,只能通过接口实现类的对象来调用
default void defaultMethod() {
System.out.println("接口中的默认方法");
}
}
标签:ret and ati ali com jdk rip app 对象
原文地址:https://www.cnblogs.com/alichengxuyuan/p/12620979.html