public class LoveYingForever {
public static void main(String[] args) {
String cxy = "20200225";
String cxc = "20220601";
//计算总和
Integer icxy = Arrays.stream(cxy.split(""))
.map(Integer::valueOf)
.reduce(Integer::sum)
.orElse(0);
Integer cxc_int = Arrays.stream(cxc.split(""))
.map(Integer::valueOf)
.reduce(Integer::sum)
.orElse(0);
Integer icxc = Arrays.stream(cxc.substring(3).split(""))
.map(Integer::valueOf)
.reduce(Integer::sum)
.orElse(0);
System.out.println("你是我的" + icxy + "所爱,愿我们的爱情天长地" + icxc);
}
}
Jdk8的Stream流真香,来自程序员的花式表白
于 2022-08-04 10:19:38 首次发布