1

Since I have an interface with two methods, how do I implement it with a concrete class? How do I write Lambda expressions for these two methods?

 interface LambdaExpression {
     void methodA();
     void methodB();
 }
Andrey Tyukin
  • 43,673
  • 4
  • 57
  • 93
Waseem Saeed
  • 85
  • 1
  • 13
  • 4
    Your interface is not a [functional interface](http://www.baeldung.com/java-8-functional-interfaces) – Ousmane D. Jan 21 '18 at 16:59
  • @AndreyTyukin, please don't edit out proper grammar and/or punctuation. You've made this nearly unreadable. – ChiefTwoPencils Jan 21 '18 at 17:13
  • @ChiefTwoPencils Sorry, there was a race condition between the two edits, for some reason "the system" decided to take my (less elaborate) edit. I didn't even attempt to fix the grammar or add any punctuation in this one. Could one roll it back to your version somehow, I agree that your version made much more sense. – Andrey Tyukin Jan 21 '18 at 17:17
  • No worries @AndreyTyukin. I think you can roll yours back if you want. – ChiefTwoPencils Jan 21 '18 at 17:19
  • @ChiefTwoPencils ok, rolled back to your version, additionaly changed "Experession" to "Expression". [cleaning up the comment section] – Andrey Tyukin Jan 21 '18 at 17:30

1 Answers1

3

You can not. Lambda expressions are for functional interfaces ie interface with only one abstract method.

Anurag Sharma
  • 2,409
  • 2
  • 16
  • 34