码迷,mamicode.com
首页 > 其他好文 > 详细

0928-----homework

时间:2016-09-29 01:47:43      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

 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 two
16           */
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

标签:

原文地址:http://www.cnblogs.com/kaililikai/p/5918146.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!