首页 > 代码库 > 0928-----homework
0928-----homework
1 /** 2 *homework0928 3 *@author:kai li 4 */ 5 package com.kai.li.homework0928; 6 import java.util.stream.IntStream; 7 /** 8 *following class is client 9 */10 public class HomeWork0928{11 12 public static void main(String[] args)throws Exception{13 14 /**15 *question one and two16 */17 18 Runnable runnable1=()->{19 long timeStart=System.currentTimeMillis();20 IntStream.range(1,101)21 .mapToObj(i->"洛阳"+i)22 .forEach(System.out::println);23 long time1=System.currentTimeMillis()-timeStart;24 System.out.println(time1);25 };26 Runnable runnable2=()->{27 long timeStart=System.currentTimeMillis();28 IntStream.range(1,101)29 .mapToObj(i->"长安"+i)30 .forEach(System.out::println);31 long time2=System.currentTimeMillis()-timeStart;32 System.out.println(time2);33 };34 Runnable runnable3=()->{35 IntStream.range(1,101)36 .mapToObj(i->"runnable3:燕京"+i)37 .forEach(System.out::println);38 };39 Thread thread1=new Thread(runnable1);40 Thread thread2=new Thread(runnable2);41 Thread thread3=new Thread(runnable3);42 thread1.start();43 thread2.start();44 thread3.start();45 46 IntStream.range(1,101)47 .mapToObj(i->"main:开封府"+i)48 .forEach(System.out::println);49 50 }51 }
0928-----homework
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。