First of all, Designer is currently experiencing problems and is not recognizing things it should.
Second of all, you need to tell us what the errors Designer is telling you.
Finally, without knowing what the errors it is complaining about, I’m going to guess that it cannot find org.openhab.core.* because all of those classes have moved in OH 2. Get rid of the fully qualified class names for all the org.openhab classes and the code should run. Though because of the aforementioned bug in Designer, it may still be marked as an error.
I wrote up a simpler example of how lambdas work here: