Why lambda returns an identical object

Nearly every book, by introducing a lambda starting with an anonymous class Runnable, is even referred to as an alternative to an anonymous class. However, lambda returns the same object, while an anonymous class returns a new one.

1. Why does lambda behave like this?

2. Why is this so?

code examples and results

+4
source share
1 answer

CallSitein your case the same, and linkage- for each site. I think in order to better understand this, you need to see what it is invokedynamic. You can read it here.

+1
source

Source: https://habr.com/ru/post/1686621/


All Articles