Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface Lambda{
- default void dummy(){
- System.out.println("Call this..");
- }
- void yummy();
- }
- public class DefaultCheck {
- public static void main(String[] args) {
- DefaultCheck check = new DefaultCheck();
- check.activate(new Lambda() {
- @Override
- public void yummy() {
- dummy();
- }
- });
- }
- void activate(Lambda lambda){
- lambda.yummy();
- }
- check.activate(() -> {
- dummy();
- });
- check.activate(new Lambda() {
- @Override
- public void yummy() {
- this.dummy();
- }
- });
- check.activate(this_ -> this_.dummy());
- @FunctionalInterface
- public interface Lambda {
- void yummy(Lambda this_);
- default void yummy() {
- yummy(this);
- }
- default void dummy(){
- System.out.println("Call this..");
- }
- }
- default String add(String b)
- {
- return "added content "+b;
- }
- default String getResult()
- {
- String c = init(this);
- return c;
- }
- public static void main(String[] args)
- {
- Value v = a -> a.add("inpout"); // here I am calling add method in Value interface.
- String c = v.getResult();
- System.out.println(c);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement