Skip to content

Commit 68cfbaa

Browse files
committed
Address comments
1 parent c2feeff commit 68cfbaa

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

src/main/java/io/appium/java_client/proxy/RemoteWebElementListener.java

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,24 @@ public Object call(Object obj, Method method, Object[] args, Callable<?> origina
5656
Object result = original.call();
5757

5858
if (result instanceof RemoteWebElement) {
59-
result = wrapElement(
59+
return wrapElement(
6060
(RemoteWebElement) result,
6161
parent,
6262
listeners);
63-
} else if (result instanceof List) {
64-
List<?> originalList = (List<?>) result;
65-
66-
if (!originalList.isEmpty()) {
67-
result = originalList.stream()
68-
.map(item -> {
69-
if (item instanceof RemoteWebElement) {
70-
return wrapElement(
71-
(RemoteWebElement) item,
72-
parent,
73-
listeners);
74-
}
75-
return item;
76-
})
77-
.collect(Collectors.toList());
78-
}
63+
}
64+
65+
if (result instanceof List) {
66+
return ((List<?>) result).stream()
67+
.map(item -> {
68+
if (item instanceof RemoteWebElement) {
69+
return wrapElement(
70+
(RemoteWebElement) item,
71+
parent,
72+
listeners);
73+
}
74+
return item;
75+
})
76+
.collect(Collectors.toList());
7977
}
8078

8179
return result;

0 commit comments

Comments
 (0)