mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-13 05:25:20 +00:00
Fix, lambda & in-line single use variable that cannot be null.
This commit is contained in:
parent
cbe3523b12
commit
af157c49d5
@ -95,15 +95,12 @@ public int getMonth() {
|
||||
String[] getMonthDisplayNames(final int style) {
|
||||
// Unfortunately standalone month names are not available in DateFormatSymbols,
|
||||
// so we have to extract them.
|
||||
final Calendar calendar = Calendar.getInstance(locale);
|
||||
final Map<String, Integer> displayNames = calendar.getDisplayNames(Calendar.MONTH, style, locale);
|
||||
if (displayNames == null) {
|
||||
return null;
|
||||
}
|
||||
final String[] monthNames = new String[displayNames.size()];
|
||||
for (final Map.Entry<String, Integer> entry: displayNames.entrySet()) {
|
||||
monthNames[entry.getValue()] = entry.getKey();
|
||||
}
|
||||
displayNames.forEach((k, v) -> monthNames[v] = k);
|
||||
return monthNames;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user