diff --git a/src/main/java/org/apache/commons/lang3/time/CalendarUtils.java b/src/main/java/org/apache/commons/lang3/time/CalendarUtils.java index 84f8d2128..ec5799baa 100644 --- a/src/main/java/org/apache/commons/lang3/time/CalendarUtils.java +++ b/src/main/java/org/apache/commons/lang3/time/CalendarUtils.java @@ -95,15 +95,12 @@ public class CalendarUtils { 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 displayNames = calendar.getDisplayNames(Calendar.MONTH, style, locale); if (displayNames == null) { return null; } final String[] monthNames = new String[displayNames.size()]; - for (final Map.Entry entry: displayNames.entrySet()) { - monthNames[entry.getValue()] = entry.getKey(); - } + displayNames.forEach((k, v) -> monthNames[v] = k); return monthNames; }