I have run into an issue with functional programming since I want to be able to get the method name, but it's not so easy to do as it is with OOP. It makes my code very clean to stay in functional programming, so I'm wondering if I can achieve what I want (sampled below) without switching over to OOP
public interface FunctionalInterface{
boolean satisfied(String v1)
}
public class functionalClass{
public static FunctionalInterface myMethod(){
satisfied(String v1) -> return v1.equals("yes");
}
public static FunctionalInterface myMethod2(){
satisfied(String v1) -> return vi.equals("no");
}
}
public class functionalClassCaller{
private final Set<FunctionalInterface> aFunctionalInterfaces = new HashSet<>();
public boolean satisfied(String v1){
for( FunctionalInterface functionalInterface : aFunctionalInterfaces )
{
if( !aFunctionalInterface.satisfied(v1))
{
//I want to know which FunctionalInterface method returns false
}
}
}
}