package test8;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
interface tt {
void show(String s);
}
public class lamda {
static void ss(tt t) {
t.show("1111111");
}
public static void main(String[] args) {
ss((a) -> System.out.println(a));
new Thread(() -> {
System.out.println(Thread.currentThread().getName());
}).start();
List<Integer> list = new ArrayList<>();
for (int i = 0; i < 20; i++) {
list.add((int) (Math.random() * 100));
}
Collections.sort(list, (a, b) -> a - b);
list.forEach(a -> System.out.print(a + " "));
System.out.println();
list.stream().filter(a -> a < 10).distinct().forEach(a -> System.out.print(a + " "));
}
}
java8 新特新 lamda 表达式 2个字 清爽
最新推荐文章于 2024-04-08 10:49:04 发布