We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9a19742 commit c55d0a8Copy full SHA for c55d0a8
src/main/java/io/appium/java_client/android/nativekey/KeyEvent.java
@@ -83,8 +83,9 @@ public KeyEvent withFlag(KeyEventFlag keyEventFlag) {
83
*/
84
public Map<String, Object> build() {
85
var map = new HashMap<String, Object>();
86
- Integer keyCode = ofNullable(this.keyCode).orElseThrow(() -> new IllegalStateException("The key code must be set"));
87
- map.put("keycode", keyCode);
+ ofNullable(this.keyCode).ifPresentOrElse(x -> map.put("keycode", x), () -> {
+ throw new IllegalStateException("The key code must be set");
88
+ });
89
ofNullable(this.metaState).ifPresent(x -> map.put("metastate", x));
90
ofNullable(this.flags).ifPresent(x -> map.put("flags", x));
91
return Collections.unmodifiableMap(map);
0 commit comments