| 操作 | 类型 | 返回类型 | 参数接口类型 | 签名 | 
|---|---|---|---|---|
| filter | 中间 | Stream | Predicate | T->boolean | 
| distinc | 中间(有状态 | Stream | ||
| skip | 中间(有状态) | Stream | long | |
| limit | 中间(有状态 | Stream | long | |
| map | 中间 | Stream | Function<T,R> | T->R | 
| flatMap | 中间 | Stream | Fucntion<T,R> | T->R | 
| sorted | 中间(有状态 | Stream | Camparator | (T,T)->int | 
| anyMatch | 终端 | boolean | Predicate | T->boolean | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import javax.swing.*; | |
| import java.awt.*; | |
| import java.io.IOException; | |
| import java.io.OutputStreamWriter; | |
| import java.io.PrintWriter; | |
| import java.io.UnsupportedEncodingException; | |
| import java.net.InetSocketAddress; | |
| import java.net.ServerSocket; | |
| import java.net.Socket; | |
| import java.nio.channels.SocketChannel; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import java.io.*; | |
| import java.time.LocalDate; | |
| public class ObjStreamTest { | |
| public static void main(String[] args) throws IOException, ClassNotFoundException { | |
| Employee harry = new Employee("harry",500,1990,11,13); | |
| Manager carl = new Manager("carl",750,1999,12,22,harry); | |
| Manager tony = new Manager("tony",850,1899,1,29,harry); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import java.lang.reflect.InvocationHandler; | |
| import java.lang.reflect.Method; | |
| import java.lang.reflect.Proxy; | |
| import java.util.Arrays; | |
| import java.util.Random; | |
| public class ProxyTest { | |
| public static void main(String[] args) { | |
| Object[] elements = new Object[100]; | |
| for (int i = 0; i < elements.length; i++) { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import java.io.*; | |
| import java.net.InetAddress; | |
| import java.net.ServerSocket; | |
| import java.net.Socket; | |
| import java.net.UnknownHostException; | |
| import java.util.Objects; | |
| import java.util.Scanner; | |
| import java.util.concurrent.ExecutorService; | |
| import java.util.concurrent.Executors; | |
| import java.util.concurrent.atomic.AtomicInteger; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import java.io.*; | |
| import java.time.LocalDate; | |
| import java.io.Serializable; | |
| /** | |
| * RandomFile的使用 | |
| * 读写Employee对象 | |
| */ | |
| public class RandomFileTest { | |
| public static void main(String[] args) throws IOException { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import java.io.FileInputStream; | |
| import java.io.FileNotFoundException; | |
| import java.io.PrintWriter; | |
| import java.io.UnsupportedEncodingException; | |
| import java.time.LocalDate; | |
| import java.util.Scanner; | |
| public class TextFileTest { | |
| public static void main(String[] args) { | |
| Employee[] staff = new Employee[3]; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | //带实例域枚举,太阳系八行星 | |
| public enum Planet { | |
| MERCURY(3.302E+23, 2.439E6), | |
| VENUS(4.869e+24, 6.0e6), | |
| EARTH(5.975e+24, 6.3e6), | |
| MARS(6.4e+23, 3.39e6), | |
| JUPITER(1.89e+27, 7.14e7), | |
| SATURN(5.68e+26, 6.02e7), | |
| URANUS(8.68e+25, 2.55e7), | |
| NEPTUNE(1.02e+26, 2.477e7); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import lombok.Data; | |
| import java.util.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| /** | |
| * pick apples match the given conditions | |
| */ | |
| public class ApplePick { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import java.util.stream.Stream; | |
| public class FibGenerator { | |
| public static void main(String[] args) { | |
| Stream.iterate(new int[]{0, 1}, t -> new int[]{t[1], t[0] + t[1]}) | |
| .limit(20) | |
| .map(t -> t[0]) | |
| .forEach(System.out::println); | |
| } | |
| } | 
OlderNewer