We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bc39a23 commit 3dfe243Copy full SHA for 3dfe243
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
- ofNullable(this.keyCode).map(x -> map.put("keycode", x)).orElseThrow(() -> new IllegalStateException(
87
- "The key code must be set"));
+ 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