Skip to content

Commit 4f10a2a

Browse files
gs-athadukashs96c
authored andcommitted
Added java 8 lambda expressions and also did some code cleanup of catching multiple exceptions in single catch block
Added java 8 lambda expressions in below classes AddFindsByCss AddFindsChildByCss AddRemoteTouchScreen AddRotatable RemoteWebElement and also did some code cleanup of catching multiple exceptions in single catch block in below class, JsonToBeanConverter Signed-off-by: Simon Stewart <[email protected]>
1 parent a5a97c9 commit 4f10a2a

File tree

5 files changed

+4
-13
lines changed

5 files changed

+4
-13
lines changed

java/client/src/org/openqa/selenium/remote/AddFindsByCss.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.openqa.selenium.remote;
1919

2020
import com.google.common.collect.ImmutableMap;
21-
2221
import org.openqa.selenium.WebDriverException;
2322
import org.openqa.selenium.internal.FindsByCssSelector;
2423

java/client/src/org/openqa/selenium/remote/AddFindsChildByCss.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.openqa.selenium.remote;
1919

2020
import com.google.common.collect.ImmutableMap;
21-
2221
import org.openqa.selenium.WebDriverException;
2322
import org.openqa.selenium.internal.FindsByCssSelector;
2423

java/client/src/org/openqa/selenium/remote/AddRotatable.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@
1818
package org.openqa.selenium.remote;
1919

2020
import com.google.common.collect.ImmutableMap;
21-
2221
import org.openqa.selenium.DeviceRotation;
2322
import org.openqa.selenium.Rotatable;
2423
import org.openqa.selenium.ScreenOrientation;
2524

2625
public class AddRotatable implements AugmenterProvider {
27-
26+
2827
public Class<?> getDescribedInterface() {
2928
return Rotatable.class;
3029
}
@@ -47,7 +46,7 @@ public InterfaceImplementation getImplementation(Object value) {
4746
response = ScreenOrientation.valueOf((String) executeMethod.execute(DriverCommand.GET_SCREEN_ORIENTATION, null));
4847
break;
4948
case "rotation":
50-
response = (DeviceRotation) executeMethod.execute(DriverCommand.GET_SCREEN_ROTATION, null);
49+
response = executeMethod.execute(DriverCommand.GET_SCREEN_ROTATION, null);
5150
break;
5251
default:
5352
throw new IllegalArgumentException(method.getName() + ", Not defined in rotatable interface");

java/client/src/org/openqa/selenium/remote/RemoteWebElement.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,7 @@ protected List<WebElement> findElements(String using, String value) {
204204
} catch (ClassCastException ex) {
205205
throw new WebDriverException("Returned value cannot be converted to List<WebElement>: " + responseValue, ex);
206206
}
207-
for (WebElement element : allElements) {
208-
parent.setFoundBy(this, element, using, value);
209-
}
210-
207+
allElements.forEach(element -> parent.setFoundBy(this, element, using, value));
211208
return allElements;
212209
}
213210

java/client/src/org/openqa/selenium/remote/SessionId.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ public int hashCode() {
3737

3838
@Override
3939
public boolean equals(Object obj) {
40-
if (obj instanceof SessionId) {
41-
return opaqueKey.equals(((SessionId) obj).opaqueKey);
42-
}
43-
return false;
40+
return obj instanceof SessionId && opaqueKey.equals(((SessionId) obj).opaqueKey);
4441
}
4542
}

0 commit comments

Comments
 (0)