Detailed explanation of Java 8 stream API — turn to

Original address: http://blog.csdn.net/chszs/article/details/47038607

1、 Stream API introduction

8 introduces a new stream API. This stream is completely different from the InputStream and OutputStream in the I / O package. It is different from the stream parsed by Stax for XML and the stream processed in real time by Amazon kinesis. Stream API is more like an iteratable collection class, but its behavior is different from that of a collection class. It enhances the function of collection objects and focuses on various very convenient and efficient aggregation operations or mass data operations on collection objects.

List
   
   
   
    
    
     list = IntStream.range(1,100).@R_23_2
   
   
   419@ed().collect(Collectors.toList());
Map
  
   
   
    
    
    map = list.stream().collect(Collectors.toMap(p -> p,q->q*3));
Sy
   stem.out.println(map);

  
   
   

A person class "> 1. Create a person class

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>