Lambda expression vs method reference implementation details

后端 未结 3 1443
梦如初夏
梦如初夏 2021-01-05 15:43

Given this:

class MyClass {
    static class A {
        public boolean property() {
            return Math.random() < 0.5;
        }
    }

    static L         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-05 16:27

    Here is the java language spec on method references.

    Here is the spec for lambda expressions.

    Lambdas are quite a bit more complex from a rules perspective.

    In both cases, however, the result is an invokedynamic call.

    Brian Goetz has written a doc on how this works.

提交回复
热议问题