文章会有【原创】或者【转载】标示,部分来自Google Baidu的学习结果 {Java/PHP/Python/Ruby/Go}

Java 在学习四十三【原创】  


package coreJava;


import java.util.ArrayList;

import java.util.Arrays;

import java.util.List;

import java.util.stream.Collectors;


import javax.security.auth.x500.X500Principal;


public class Test23 {


public static void main(String[] args) {

for (int i = 0; i < 10; i++) {

new Thread(() -> System.out.println(Thread.currentThread().getName() + " Test...")).start();

}

List<String> language = Arrays.asList("java", "php", "python");

language.forEach(x -> System.out.println(x));

List<Double> cost = new ArrayList<Double>();

cost.add(10.0);

cost.add(20.0);

cost.stream().map(x -> x + x * 0.05).forEach(x -> System.out.println(x));

System.out.println("######################################");

double dsum = cost.stream().map(x -> x + x * 0.05).reduce((sum, x) -> sum + x).get();

System.out.println(dsum);

System.out.println("######################################");

List<Double> filterList = Arrays.asList(10.0, 20.0, 30.0, 40.0, 50.0);

filterList.stream().filter(x -> x > 25.0).collect(Collectors.toList()).forEach(x -> System.out.println(x));

}

}