Skip to content

Commit

Permalink
refactor: simplify getFlagCode method
Browse files Browse the repository at this point in the history
  • Loading branch information
elPeiretti authored and javier-godoy committed Aug 22, 2024
1 parent 9b317d3 commit 9089c58
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,8 @@ private Locale getLocaleForDisplay() {

private String getFlagCode(Locale locale) {
String countryCode = locale.getCountry();
Optional<String> isoCode = LocaleCountryConverter.convertToISO3166Code(countryCode);

if (isoCode.isPresent())
return isoCode.get().toLowerCase();

return DEFAULT_FLAG_CODE;
return LocaleCountryConverter.convertToISO3166Code(countryCode).map(String::toLowerCase)
.orElse(DEFAULT_FLAG_CODE);
}

private void onValueChange(ComponentValueChangeEvent<ComboBox<Locale>, Locale> event) {
Expand Down

0 comments on commit 9089c58

Please sign in to comment.