Reference method (method reference)

Reference method (method reference)

1. Meaning

  • Reference method is actually a syntactic sugar Lambda expressions.
  • The method we can reference as a "function pointer", function pointer

2. Classification

Reference method is divided into four categories:

  1. Class name :: static method name
  2. Reference name (object name) :: instance method name
  3. Examples of the method name of the class name :: (difficult to understand)
  4. Constructor reference: Class name :: new (actually call the constructor method to generate a class object of this class)

3. Summary

The method is called the reference method are readily available, already exists, can not be used in addition. Is an extension of lambda expressions (reference method can be used as a constant lambda expressions can be rewritten, it may be referred to by a method not necessarily rewritable lambda expressions, because the method reference may not exist).

Guess you like

Origin www.cnblogs.com/weixuqin/p/11494901.html