Skip to content

Commit

Permalink
fix: Fix building of Android key event parameters (#2145)
Browse files Browse the repository at this point in the history
Co-authored-by: Valery Yatsynovich <valery_yatsynovich@epam.com>
  • Loading branch information
artlomako and valfirst authored Mar 28, 2024
1 parent bc39a23 commit 3dfe243
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ public KeyEvent withFlag(KeyEventFlag keyEventFlag) {
*/
public Map<String, Object> build() {
var map = new HashMap<String, Object>();
ofNullable(this.keyCode).map(x -> map.put("keycode", x)).orElseThrow(() -> new IllegalStateException(
"The key code must be set"));
ofNullable(this.keyCode).ifPresentOrElse(x -> map.put("keycode", x), () -> {
throw new IllegalStateException("The key code must be set");
});
ofNullable(this.metaState).ifPresent(x -> map.put("metastate", x));
ofNullable(this.flags).ifPresent(x -> map.put("flags", x));
return Collections.unmodifiableMap(map);
Expand Down

0 comments on commit 3dfe243

Please sign in to comment.