Java8 new feature (c) of the method and the references cited constructor

1. Scene

  To be transmitted to the operator when the body Lambda implemented methods already exist, a reference method can be used. (Abstract method parameter list must reference the method's parameter list and methods consistent)

2. Grammar

  :: operator [] used to separate the method name and the name of the object or class. The three main use cases:

  1) Object instance method ::

  2) :: class static method

  3) Examples of the method class ::

3. The method of using a reference

  1) (x) -> System.out.println (x); equivalent to System.out :: println;

  2)

Guess you like

Origin www.cnblogs.com/sun-flower1314/p/11259180.html