Q:

Using lambda expressions with non-functional interfaces in Java

I have a bunch of animation listeners in my code where only one method in the interface used the majority of the time.
So I created this wrapper:
public class AnimationWrapper {
    private Animation mAnimation;

    public AnimationWrapper(Animation animation) {
        mAnimation = animation;
    }

    public Animation getAnimation() {
        return mAnimation;
    }

    public interface OnAnimationEnd {
        void onAnimationEnd(Animation animation);
    }

    public interface OnAnimationStart {
        void onAnimationStart(Animation animation);
    }

    public void setAnimationEndListener(OnAnimationEnd listener) {
        mAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                listener.onAnimationEnd(animation);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
    }

    public void setAnimationStartListener(OnAnimationStart listener) {
        mAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
                listener.onAnimationStart(animation);
            }

            @Override
            public void onAnimationEnd(Animation animation) {

            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
    }
}

That way code like this:
Animation animation = AnimationUtils.loadAnimation(context, R.anim.my_animation);

animation.setAnimationListener(new Animation.AnimationListener() {
    @Override
    public void onAnimationStart(Animation animation) {

    }

    @Override
    public void onAnimationEnd(Animation animation) {
        doSomething();
    }

    @Override
    public void onAnimationRepeat(Animation animation) {

    }
});

Ends looking like this:
    AnimationWrapper wrapper = new AnimationWrapper(AnimationUtils.loadAnimation(context, R.anim.my_animation));
    wrapper.setAnimationEndListener(a -> doSomething());

I'm just wondering whether there a better way to split non-functional interfaces into separate interfaces with one method, so that each method can be used separately with lambda expressions.

A:

Instead of wrapping the animation, I would wrap the functional, one-method listener into a "real", multi-method listener (i.e. apply the Adapter design pattern):
public interface OnAnimationEnd {
    void onAnimationEnd(Animation animation);
}

public interface OnAnimationStart {
    void onAnimationStart(Animation animation);
}

public class AnimationListeners {
    public static Animation.AnimationListener adapt(OnAnimationStart oas) {
        return new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                oas.onAnimationStart(animation);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        });
    }

    // same for the end
}

And you would just use
animation.setAnimationListener(AnimationListeners.adapt(a -> doSomething()));

With a static import of the adapt method, it becomes
animation.setAnimationListener(adapt(a -> doSomething()));

