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 class CalendarUtils {
|
||||||
String[] getMonthDisplayNames(final int style) {
|
String[] getMonthDisplayNames(final int style) {
|
||||||
// Unfortunately standalone month names are not available in DateFormatSymbols,
|
// Unfortunately standalone month names are not available in DateFormatSymbols,
|
||||||
// so we have to extract them.
|
// so we have to extract them.
|
||||||
final Calendar calendar = Calendar.getInstance(locale);
|
|
||||||
final Map<String, Integer> displayNames = calendar.getDisplayNames(Calendar.MONTH, style, locale);
|
final Map<String, Integer> displayNames = calendar.getDisplayNames(Calendar.MONTH, style, locale);
|
||||||
if (displayNames == null) {
|
if (displayNames == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final String[] monthNames = new String[displayNames.size()];
|
final String[] monthNames = new String[displayNames.size()];
|
||||||
for (final Map.Entry<String, Integer> entry: displayNames.entrySet()) {
|
displayNames.forEach((k, v) -> monthNames[v] = k);
|
||||||
monthNames[entry.getValue()] = entry.getKey();
|
|
||||||
}
|
|
||||||
return monthNames;
|
return monthNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue