I am new to Java-8 and appium and trying to write my webdriver code in Java-8 as mentioned below
Currently below code is working fine but I don't want to write Function and Consumer in separate lines as mentioned below in lines line 5 and line 6 and i want to optimize the code more i.e something like Function within Consumer or Consumer within Function.Thanks! in Advance
public class Gestures_Drag_And_Drop {
AndroidDriver<AndroidElement> driver;
Function<String, AndroidElement> F = driver::findElementByXPath;//line 5
Consumer<AndroidElement> C = AndroidElement::click; //line 6
Gestures_Drag_And_Drop() {
C.accept(F.apply("//android.widget.TextView[@text='Views']"));
}
public static void main(String[] args) throws MalformedURLException {
new Gestures_Drag_And_Drop();
}
}