lundi 23 mars 2015

Is it a good idea to contextually name predefined functional interfaces?


I am currently working with Java 8 and using functional interfaces a lot. I often find myself writing code like this:



public interface MessageHandler extends Consumer<String> { }


Is this a good idea or an indicator of me abusing functional interfaces to make Java feel more like C#?


Edit: Maybe to expand a little:



public class MessageGenerator {

public void registerMessageHandler(MessageHandler handler) {
// [...]

public interface MessageHandler extends Consumer<String> { }
}




Aucun commentaire:

Enregistrer un commentaire